Skip to content

Add ameba #15875

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

Merged
merged 6 commits into from
Jun 16, 2025
Merged

Add ameba #15875

merged 6 commits into from
Jun 16, 2025

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jun 4, 2025

Adds configuration and a CI job for https://github.com/crystal-ameba/ameba

I let ameba generate a config (ameba --gen-config) but replaced all exclusions with hard disables. Then I fixed the violations for some of the rules, which have already been merged in the last couple of days. So I removed the disables for these rules.

The configuration is annotated with explanations in code.

I have disabled most Naming and Style rules because most had large numbers of violations and some of them seem questionable. We can consider enabling some of the in the future, piece by piece

For review, it's best to ignore the first three commits and review the rest combined, not the individual commits.
Depends on #15860, #15870

Resolves #14608
Closes #14631

@straight-shoota straight-shoota self-assigned this Jun 4, 2025
@straight-shoota straight-shoota changed the title Add ameba to this repo Add ameba Jun 4, 2025
@straight-shoota straight-shoota marked this pull request as ready for review June 12, 2025 07:55
Copy link
Contributor

@ysbaddaden ysbaddaden left a comment

Choose a reason for hiding this comment

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

That's a lot of disabled rules. How many are left 😅

@straight-shoota
Copy link
Member Author

straight-shoota commented Jun 13, 2025

$ ameba -r | tail -n1
Total rules: 77 / 45 enabled
$ ameba -v
1.6.4
$ ameba-master -r | tail -n1
Total rules: 101 / 58 enabled
$ ameba-master -v
1.7.0-dev

@straight-shoota straight-shoota added this to the 1.17.0 milestone Jun 13, 2025
Comment on lines +74 to +77
# BUG: https://github.com/crystal-ameba/ameba/issues/612
Lint/TopLevelOperatorDefinition:
Enabled: false

Copy link
Contributor

Choose a reason for hiding this comment

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

This has been already fixed.

Suggested change
# BUG: https://github.com/crystal-ameba/ameba/issues/612
Lint/TopLevelOperatorDefinition:
Enabled: false

Comment on lines +168 to +171
# BUG: https://github.com/crystal-ameba/ameba/issues/614
Style/ParenthesesAroundCondition:
Enabled: false

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Suggested change
# BUG: https://github.com/crystal-ameba/ameba/issues/614
Style/ParenthesesAroundCondition:
Enabled: false

Copy link
Member Author

Choose a reason for hiding this comment

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

The fix is only in master. Latest ameba release is still broken.
There are also still other violations of this rule. This is a TODO for a follow-up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Whole 1.7.0-dev is only in master, so... 🤷‍♂️

Comment on lines +48 to +51
Lint/LiteralInInterpolation:
Excluded:
- spec/std/random_spec.cr # BUG: https://github.com/crystal-ameba/ameba/issues/611

Copy link
Contributor

Choose a reason for hiding this comment

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

That was just fixed and landed in master.

Suggested change
Lint/LiteralInInterpolation:
Excluded:
- spec/std/random_spec.cr # BUG: https://github.com/crystal-ameba/ameba/issues/611

@straight-shoota
Copy link
Member Author

straight-shoota commented Jun 15, 2025

@Sija I'll merge this as is. The purpose of this PR is to setup a basic configuration. It's not meant to be the final word. Further changes just cause more delays, which creates friction.
We can address all disabled rules in follow-ups.

@straight-shoota straight-shoota merged commit 46a5f13 into master Jun 16, 2025
85 of 86 checks passed
@straight-shoota straight-shoota deleted the infra/ameba branch June 16, 2025 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable ameba in this repo
3 participants