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

Path for source files in config file should preserve relative position #231

Open
veelenga opened this issue Apr 21, 2021 · 0 comments
Open

Comments

@veelenga
Copy link
Member

veelenga commented Apr 21, 2021

Relates to #8
cc @petr-fischer

Reproduction:

$ cat ameba/.ameba.yml                                                                                                                                                                                       
# This configuration file was generated by `ameba --gen-config`
# on 2021-04-21 10:00:29 UTC using Ameba version 0.14.3.
# The point is for the user to remove these configuration records
# one by one as the reported problems are removed from the code base.

# Problems found: 1
# Run `ameba --only Lint/UselessAssign` for details
Lint/UselessAssign:
  Description: Disallows useless variable assignments
  Excluded:
  - src/ameba/config.cr
  Enabled: true
  Severity: Warning

Working correctly

$ cd ameba
$ ameba /Users/me/Dev/repos/ameba/src/ameba/config.cr --format json --config /Users/me/Dev/repos/ameba/.ameba.yml

# no errors

Working incorrectly

$ cd ../
$ ameba /Users/me/Dev/repos/ameba/src/ameba/config.cr --format json --config /Users/me/Dev/repos/ameba/.ameba.yml

{"sources":[{"path":"/Users/me/Dev/repos/ameba/src/ameba/config.cr","issues":[{"rule_name":"Lint/UselessAssign","severity":"Warning","message":"Useless assignment to variable `test`","location":{"line":124,"column":5},"end_location":{"line":124,"column":8}}]}],"metadata":{"ameba_version":"0.14.3","crystal_version":"1.0.0"},"summary":{"target_sources_count":1,"issues_count":1}}% 

The path is inappropriately matched in

def excluded?(source)
excluded.try &.any? do |path|
source.matches_path?(path) ||
Dir.glob(path).any? { |glob| source.matches_path?(glob) }
end
end

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

No branches or pull requests

2 participants