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

indentation_width warning when preprocessor statements are used #4121

Closed
2 tasks done
phranck opened this issue Aug 23, 2022 · 11 comments · Fixed by #4688
Closed
2 tasks done

indentation_width warning when preprocessor statements are used #4121

phranck opened this issue Aug 23, 2022 · 11 comments · Fixed by #4688
Labels
bug Unexpected and reproducible misbehavior.

Comments

@phranck
Copy link

phranck commented Aug 23, 2022

New Issue Checklist

Describe the bug

It was fixed in #4066, unfortunately not completely. Please have a look at: #4030 (comment).

@SimplyDanny
Copy link
Collaborator

Works on my machine ... 😄

Are you sure the new option is set to false and you are using one of the release candidates for version 0.49.0? The fix is not contained in version 0.48.0 or earlier.

@SimplyDanny SimplyDanny added the repro-needed Issues that cannot be reproduced or miss proper descriptive examples. label Sep 9, 2022
@SwiftNativeDeveloper
Copy link

SwiftNativeDeveloper commented Jan 13, 2023

This does not work on my machine and my colleagues. We have both have 0.50.3 installed.

indent-width-rule-fail

@SimplyDanny
Copy link
Collaborator

@SwiftNativeDeveloper, @phranck: Please try swiftlint lint --no-cache and let me know whether the warnings disappear.

@SimplyDanny SimplyDanny added bug Unexpected and reproducible misbehavior. and removed repro-needed Issues that cannot be reproduced or miss proper descriptive examples. labels Jan 13, 2023
@SwiftNativeDeveloper
Copy link

@SwiftNativeDeveloper, @phranck: Please try swiftlint lint --no-cache and let me know whether the warnings disappear.

My colleague cleaned derived data and restarted Xcode and that worked for him. Next time we have stuck settings I'll share the --no-cache flag. Thanks!

@phranck
Copy link
Author

phranck commented Jan 29, 2023

@SimplyDanny
Unfortunately, this rule still doesn't work.
I have a "Run Script Phase" containing the following:

export PATH="$PATH:/opt/homebrew/bin"
if which swiftlint > /dev/null; then
  swiftlint lint --no-cache
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

I have opt in the rule indentation_width with this setting:

indentation_width:
  include_compiler_directives: false

and I still get the warning:

image

@SimplyDanny
Copy link
Collaborator

Does it work on the plain command line without any Xcode and build scripts involved?

@phranck
Copy link
Author

phranck commented Jan 29, 2023

Yes, indeed. There it does. The warnings from screenshot above are from MainView.swift.

image

@SimplyDanny
Copy link
Collaborator

Are you sure the configuration file is taken into account when running SwiftLint as a build step? Maybe try with an explicit --config option.

@phranck
Copy link
Author

phranck commented Jan 29, 2023

This is strange. The MyProject.xcodeproj and the .swiftlint.yml are in the same folder. Running swiftlint --no-cache from within this folder everyhting is fine.

Calling the linter in the build phase script with swiftlint --no-cache --config ${PROJECT_DIR}/.swiftlint.yml it doesn't work. ${PROJECT_DIR} points exactly to the folder where MyProject.xcodeproj is and swiftlint is being called from this folder while the build phase script is running. 🤔

@phranck
Copy link
Author

phranck commented Feb 2, 2023

Am I the only one still seeing the warnings? 🤔
My current Runs Script Phase looks like this, and still warnings...

export PATH="$PATH:/opt/homebrew/bin"
if which swiftlint > /dev/null; then
  swiftlint --no-cache --config ${PROJECT_DIR}/.swiftlint.yml
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

@SimplyDanny
Copy link
Collaborator

Let's wait for the next release and reevaluate then. There definitely was a bug in the caching mechanism that is now fixed and will be available with the next version.

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

Successfully merging a pull request may close this issue.

3 participants