kimdv / bitrise-step-swiftlint Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I set Linting configuration file
in Options
section, but it ignores the configuration file.
My config's file name is swiftlint.yml
Log:
INFO[08:09:27] * [OK] Step dependency (swiftlint) installed, available.
+ '[' -z /Users/vagrant/git ']'
+ cd /Users/vagrant/git
+ '[' -z /Users/vagrant/git/swiftlint.yml ']'
+ swiftlint lint --reporter xcode
Loading configuration from '.swiftlint.yml'
The new lint_range
property is defined as required
, but it doesn't have a default value set in the .yml
and if it is undefined, it just fails the linting silently.
I just stumbled upon this while working on something else, I fear that when users on Bitrise update to the new version, it's going to fail silently for everybody.
Funny thing is, the default value was originally there, but for some reason it was removed in this commit.
Hi.
We have a problem with the linter step for 2-3w roughly.
On our repo we have a branch on which this step wasn't problematic on the 2nd of November:
We haven't touched this branch (no new commit) since then as I've been in holidays. Now that I'm back, the same flow doesn't work anymore and fails on the linter step SwiftLint.
The log is now showing violations and stuff it didn't use to bring up:
Done linting! Found 451 violations, 10 serious in 862 files.
| |
+---+---------------------------------------------------------------+----------+
| x | [email protected] (exit code: 2) | 23.66 sec|
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/kimdv/bitrise-step-swiftlint/issues |
| Source: https://github.com/kimdv/bitrise-step-swiftlint |
+---+---------------------------------------------------------------+----------+
Before:
Done linting! Found 2 violations, 0 serious in 862 files.
Saved swiftlint output in SWIFTLINT_REPORT
Saved swiftlint output in file at path SWIFTLINT_REPORT_PATH
| |
+---+---------------------------------------------------------------+----------+
| ✓ | [email protected] | 24.01 sec|
+---+---------------------------------------------------------------+----------+
To me it looks like the linter isn't taking our swiftlint.yml file as a reference for the linting anymore but the default one.
Bitrise support recommended me to contact you as they couldn't find anything in their stack changes that could have had this impact.
Can you help please?
Thanks.
When we run Swiftlint from the Bitrise step and locally, we have two different reports.
Locally we only have 1 violation:
/Users/../Documents/git/tt-mobi/TTMobi/TTMobi/Application/Common Views/Table View/Cells/HighlightableCell.swift:14:8: warning: Todo Violation: TODOs should be resolved (Set colour IBInspectables back...) (todo)
Done linting! Found 1 violation, 0 serious in 682 files.
And on the CI we have 27. See attachment swiftlint_report.txt
In order for us to compare the differences, we need your help to identify the Swiftlint version used in the step. We looked into the logs and the steps and did not find the information.
Locally: 0.53.0
If we set the mode to strict and linting fails, the script exits before having the chance to copy the report to SWIFTLINT_REPORT_PATH
.
This obfuscates the results and doesn't provide clear feedback to developers what went wrong.
I didn't dig too much into this, but when I found the (new to me) "Test Reports Add-on" always showed no reports despite many runs, I removed this SwiftLint step (version 0.4.2) and replaced it with a simple shell script:
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install swiftlint
After this change, the test reports started showing up in the add-on as expected. (My SwiftLint validation is already done in an Xcode build step, so I didn't need the "run tests" part of this step).
Hey.
It would be great to add a checkbox in the bitrise config which enabled the --strict
command line option to the lint command. This would default to false, to keep backwards compatibility.
@kimdv looks great so far! Not sure if you want to add any other feature to the step, right now it will install swiftlint and run it in the current directory - maybe an input for where swiftlint lint should be run would be useful? Just an idea :slight_smile:
From @viktorbenei
I added variable for swliftlint result in shell script code.
But I can't understand how can I output to bind variable to outputs:
in step.yml
Could you explain step by step to configure output?
I may be wrong with this one, but when I think that because of this:
set -ex
the script will exit when it encounters an error. So, when reading line by line using the lint_range
like so:
git diff --name-only | while read filename; do run_swiftlint "${filename}" "${reporter}" "${FLAGS}"; done
git diff --cached --name-only | while read filename; do run_swiftlint "${filename}" "${FLAGS}"; done
it's gonna exit on the first line with an error. So only one error maximum can be printed to the console at a time, right? Btw. why do we have 2 loops here? Sorry if this is a noob question but bash is not my native language ;)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.