Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --lenient CLI option to lint command #1364

Merged
merged 9 commits into from
Mar 23, 2017
Merged

Add --lenient CLI option to lint command #1364

merged 9 commits into from
Mar 23, 2017

Conversation

aaroncrespo
Copy link
Contributor

No description provided.

@aaroncrespo
Copy link
Contributor Author

see #1359 for previous discussion

@aaroncrespo
Copy link
Contributor Author

#1322

@aaroncrespo
Copy link
Contributor Author

newest danger release appears to be hanging bundle exec danger --verbose

@SwiftLintBot
Copy link

SwiftLintBot commented Mar 20, 2017

12 Messages
📖 Linting WordPress-iOS with this PR took 18.65s vs 19.28s on master (3% faster)
📖 Linting swift with this PR took 17.88s vs 16.42s on master (8% slower)
📖 Linting Aerial with this PR took 0.66s vs 0.57s on master (15% slower)
📖 Linting SourceKitten with this PR took 1.96s vs 1.55s on master (26% slower)
📖 Linting Sourcery with this PR took 4.87s vs 3.73s on master (30% slower)
📖 Linting ios-oss with this PR took 27.52s vs 30.1s on master (8% faster)
📖 Linting Alamofire with this PR took 6.33s vs 4.8s on master (31% slower)
📖 Linting firefox-ios with this PR took 25.37s vs 30.54s on master (16% faster)
📖 Linting Nimble with this PR took 2.2s vs 3.38s on master (34% faster)
📖 Linting Quick with this PR took 0.71s vs 0.98s on master (27% faster)
📖 Linting realm-cocoa with this PR took 3.68s vs 4.98s on master (26% faster)
📖 Linting Moya with this PR took 0.8s vs 0.78s on master (2% slower)

Generated by 🚫 danger

@aaroncrespo
Copy link
Contributor Author

@marcelofabri the CI issue is resolved

CHANGELOG.md Outdated
@@ -3,136 +3,141 @@
##### Breaking

* `variable_name` rule (`VariableNameRule`) is now `identifier_name`
(`IdentifierNameRule`) as it validates other identifiers as well.
(`IdentifierNameRule`) as it validates other identifiers as well.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the trailing whitespace shouldn't be removed

@@ -137,6 +150,8 @@ struct LintOptions: OptionsProtocol {
<*> mode <| configOption
<*> mode <| Option(key: "strict", defaultValue: false,
usage: "fail on warnings")
<*> mode <| Option(key: "lenient", defaultValue: false,
usage: "succeed on errors")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should have a better description, since it's not the only thing that this option does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"downgrades serious violations to warnings, and any warning threshold is disabled"

return violations
}
return violations.map {
$0.severity == .error ? StyleViolation(ruleDescription: $0.ruleDescription,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you split this into an if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

@aaroncrespo aaroncrespo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see updates for review

@@ -137,6 +150,8 @@ struct LintOptions: OptionsProtocol {
<*> mode <| configOption
<*> mode <| Option(key: "strict", defaultValue: false,
usage: "fail on warnings")
<*> mode <| Option(key: "lenient", defaultValue: false,
usage: "succeed on errors")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"downgrades serious violations to warnings, and any warning threshold is disabled"

@codecov-io
Copy link

codecov-io commented Mar 23, 2017

Codecov Report

Merging #1364 into master will decrease coverage by 0.11%.
The diff coverage is 0%.

@@            Coverage Diff            @@
##           master   #1364      +/-   ##
=========================================
- Coverage   81.91%   81.8%   -0.12%     
=========================================
  Files         181     181              
  Lines        9076    9089      +13     
=========================================
  Hits         7435    7435              
- Misses       1641    1654      +13
Impacted Files Coverage Δ
Source/swiftlint/Commands/LintCommand.swift 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3547aa...fbd9ad3. Read the comment docs.

Copy link
Contributor Author

@aaroncrespo aaroncrespo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done pending a change to help text

@marcelofabri marcelofabri merged commit 90351da into realm:master Mar 23, 2017
@marcelofabri
Copy link
Collaborator

Thanks for the patience!

@NachoSoto
Copy link
Contributor

NachoSoto commented Mar 24, 2017

Hmm this isn't working for me

screen shot 2017-03-24 at 10 09 20 am

screen shot 2017-03-24 at 10 09 25 am

This is the end of the script:

Done linting! Found 14 violations, 0 serious in 122 files.
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

Somehow it says it found 0 serious violations, even though it did emit errors:

/Users/nachosoto/dev/corsac/#!$%^.swift:497:21: error: Trailing Semicolon Violation: Lines should not have trailing semicolons. (trailing_semicolon)

Note that I obviously don't use semicolons, this is just a test 😅

@marcelofabri
Copy link
Collaborator

@NachoSoto can you please open an issue to track this?

@aaroncrespo
Copy link
Contributor Author

Looks like wrt Xcode builds I needed to do more than suppress severity and correct return status. Our use case is running this on a server. outside of Xcode so I didn't see this case. Need to suppress emitting of Xcode errors I think.

@NachoSoto
Copy link
Contributor

#1391.

@aaroncrespo
Copy link
Contributor Author

looks like the issue is

violations = LintCommand.applyLeniency(options: options, violations: **violations**)
reporter.report(violations: **currentViolations**, realtimeCondition: true)

fix should be

violations = LintCommand.applyLeniency(options: options, violations: violations)
currentViolations = LintCommand.applyLeniency(options: options, violations: currentViolations)
reporter.report(violations: currentViolations, realtimeCondition: true)

@aaroncrespo
Copy link
Contributor Author

or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants