Release in numbers
Our biggest release yet 🐳
- Almost 3 years in the works
- 333 closed issues/PRs
- 37 new rules
What's Changed
Warning
Breaking changes ahead!
Each is marked by the following sign:
Community
With this release, we've grown more than just a version, as we've got a new team member — @nobodywasishere ❤️
New website and domain
Ameba website has been redesigned and is now available at crystal-ameba.org.
New Rules
37 new rules added.
Lint
Lint/AssignmentInCallArgumentrule by @Sija in #777Lint/DeprecatedRulerule by @Sija in #829Lint/DuplicateBranchrule by @Sija in #582Lint/DuplicateEnumValuerule by @Sija in #680Lint/DuplicateMethodSignaturerule by @Sija in #697Lint/DuplicateWhenConditionrule by @Sija in #568, #575Lint/ElseNilrule by @Sija in #601Lint/EnumMemberNameConflictrule by @Sija in #694Lint/NonExistentRulerule by @Sija in #809, #818Lint/RequireParenthesesrule by @nobodywasishere in #510Lint/SelfInitializeDefinitionrule by @Sija in #636Lint/SignalTraprule by @Sija in #591Lint/SpecEqWithBoolOrNilLiteralrule by @Sija in #567, #609Lint/TopLevelOperatorDefinitionrule by @nobodywasishere in #579, #587, #613Lint/TrailingRescueExceptionrule by @nobodywasishere in #512Lint/UnusedExpressionrule by @nobodywasishere in #507, #533, #537, #552, #556, #646Lint/UnusedRescueVariablerule by @Sija in #766, #817Lint/UselessVisibilityModifierrule by @Sija in #639, #867Lint/VoidOutsideLibrule by @nobodywasishere in #602Lint/WhitespaceAroundMacroExpressionrule by @Sija in #583
Style
Style/CallParenthesesrule by @Sija in #737, #834, #837, #839, #842, #843, #860Style/Elsifrule by @Sija in #723, #739Style/HeredocEscaperule by @nobodywasishere & @Sija in #580, #635Style/HeredocIndentrule by @nobodywasishere & @Sija in #554, #747, #750, #754Style/MultilineCurlyBlockrule by @nobodywasishere in #524, #595, #597Style/MultilineStringLiteralrule by @Sija in #679, #804Style/PercentLiteralDelimitersrule by @Sija in #570, #594Style/RedundantNilInControlExpressionrule by @Sija in #695Style/RedundantSelfrule by @Sija in #547, #607, #701, #751Style/VerboseNilTyperule by @Sija in #736, #745, #746, #891Style/ArrayLiteralSyntaxrule by @nobodywasishere in #644Style/HashLiteralSyntaxrule by @nobodywasishere in #644
Typing
Typing/MacroCallArgumentTypeRestrictionrule by @nobodywasishere in #521Typing/MethodParameterTypeRestrictionrule by @nobodywasishere & @Sija in #520, #664Typing/MethodReturnTypeRestrictionrule by @nobodywasishere in #519Typing/ProcLiteralReturnTypeRestrictionrule by @nobodywasishere in #522
Performance
Renamed Rules
Documentation/DocumentationAdmonition->Documentation/Admonitionrule by @Sija in #647⚠️ Lint/DuplicatedRequire->Lint/DuplicateRequirerule by @Sija in #873⚠️
Deprecated Rules
Rules disabled by default
New Rule Options
Documentation/Documentation: AddRequireExampleoption by @Sija in #727Lint/SpecFilename: AddIgnoredPathsoption by @Sija in #850Naming/BinaryOperatorParameterName: AddAllowedNamesoption by @Sija in #690Style/ParenthesesAroundCondition: AddExcludeMultilineoption by @Sija in #649
Removed Rule Options
Lint/UselessAssign: RemoveExcludeTypeDeclarationsoption by @Sija in #769⚠️ Lint/SpecFilename: RemoveIgnoredDirsoption by @Sija in #850⚠️ Lint/SpecFilename: RemoveIgnoredFilenamesoption by @Sija in #850⚠️
Rule Enhancements
Lint/RedundantStringCoercion: Add autocorrect by @Sija in #885Lint/ShadowedArgument: Move to liveness analysis by @veelenga in #795Lint/SharedVarInFiber: Move to liveness analysis by @veelenga in #795Lint/UnreachableCode: Support control expressions in blocks by @Sija in #872, #889Lint/UselessAssign: Refactor rule using liveness analysis by @veelenga in #785, #799, #805, #810Naming/BlockParameterName: Addaandbto allowed name list by @Sija in #675Naming/BlockParameterName: Addwg(WaitGroup) as allowed block parameter name by @mamantoha in #589Naming/RescuedExceptionsVariableName: Adderrto allowed name list by @Sija in #814Performance/ChainedCallWithNoBang: Addunstable_sortto the call name list by @Sija in #558Style/RedundantBegin: Apply the rule to blocks as well by @Sija in #865Style/RedundantNext: Reportif/unlessbranches with noelseby @Sija in #820Style/RedundantReturn: Reportif/unlessbranches with noelseby @Sija in #820
Improved Issue Locations
- Tweak reported location of
Documentation/Admonitionissues by @Sija in #569 - Tweak reported location of
Lint/BadDirectiveissues by @Sija in #572 - Tweak reported location of
Lint/LiteralInConditionissues by @Sija in #574 - Tweak reported location of
Lint/PercentArraysissues by @Sija in #571 - Tweak reported location of
Lint/UnneededDisableDirectiveissues by @Sija in #573 - Tweak reported location of
Lint/UnreachableCodeissues by @Sija in #870 - Tweak reported location of
Lint/UnusedArgumentissues by @Sija in #657 - Tweak reported location of
Naming/BinaryOperatorParameterNameissues by @Sija in #661 - Tweak reported location of
Naming/BlockParameterNameissues by @Sija in #661 - Tweak reported location of
Naming/RescuedExceptionsVariableNameissues by @Sija in #661 - Tweak reported location of
Naming/ShadowingOuterLocalVarissues by @Sija in #662 - Tweak reported location of
Naming/VariableNamesissues by @Sija in #663 - Tweak reported location of
Style/RedundantNextissues by @Sija in #821 - Tweak reported location of
Style/RedundantReturnissues by @Sija in #821
Rule Bug Fixes
Layout/TrailingWhitespace: Do not report CRLF sequences by @Sija in #627Lint/Formatting: AvoidIndexErrorwhen autocorrecting source with no trailing newline by @SAY-5 in #832Lint/LiteralInInterpolation: Do not report magic constants by @Sija in #596Lint/LiteralInInterpolation: Report only static literals by @Sija in #638Lint/LiteralsComparison: Fix regression by @Sija in #630Lint/LiteralsComparison: Skip dynamic literals comparison by @Sija in #633Lint/SpecFocus: Do not reportfocusvalues which are calls or vars by @Sija in #606Lint/UnneededDisableDirective: Rule fixes by @veelenga in #788Lint/UnneededDisableDirective: Skip non-existent rules by @Sija in #808Lint/UselessAssign: Avoid inheriting vars from outer scope indefby @straight-shoota in #625Lint/UselessAssign: Do not report type declarations within calls by @Sija in #769, #776Lint/UselessAssign: Fix scopes by @veelenga in #784Lint/ShadowingOuterLocalVar: Do not flag block argument shadowing across mutually exclusive branches by @veelenga in #824Lint/ShadowingOuterLocalVar: Do not flag block argument shadowing inside the initial assignment by @veelenga in #826Lint/ShadowingOuterLocalVar: Avoid false positives across unconnected branches by @veelenga in #838Lint/SpecFilename: UseSource#project_pathproperty to get relative path by @Sija in #851, #854Metrics/CyclomaticComplexity: Includeunlessin nodes counted by @Sija in #586Naming/AccessorMethodName: Fix false-positives by @Sija in #716Naming/ConstantNames: Fix reporting single-line constant assigns with namespaces by @nobodywasishere in #655Performance/AnyInsteadOfPresent: Fix autocorrection bug by @Sija in #712Style/ParenthesesAroundCondition: Fix autocorrection putting right parenthesis on newline when condition ends with implicit call by @FnControlOption in #548Style/ParenthesesAroundCondition: Do not strip parentheses from conditions withrescue,ensure,iforunlessby @Sija in #631
New Features
- Add support for linting ECR files by @nobodywasishere in #536, #540, #541, #546
⚠️ - Add GitHub Actions formatter by @Sija in #527, #531, #758
- Implement rule versioning by @Sija in #471, #752, #767
- Add JSON Schema for
.ameba.yml(and its generator) by @nobodywasishere & @Sija in #497, #685, #687, #692, #698, #699, #714 - Implement rule deprecation mechanism by @Sija in #829
Enhancements
- Versioned documentation by @Sija in #702, #704
⚠️ - Replace
--fail-levelCLI switch with--min-severityby @Sija in #761⚠️ - Silently ignore unknown config attributes, instead of failing by @Sija in #840
⚠️ - Sort sources and issues before passing them to the formatter by @Sija in #528, #576
- Sort TODO issues by rule name by @straight-shoota in #610
- Remove noise from
--gen-configby @straight-shoota in #616 - Make issue messages moar Markdown-friendly by @Sija in #529
- Improve markdown text styles rendering in CLI by @Sija in #700
- Add Git SHA to the printed version by @Sija in #641, #643
- Add autocorrect to more rules by @veelenga in #796
- Add ability to ignore
:nodoc:methods inTypingrules by @Sija in #557 - Add
--ignore-configCLI flag by @Sija in #841, #845 - Make
Presenter::RulePresenteroutput the rule documentation url by @Sija in #868, #869
Bug Fixes
- Implement project root directory detection by @Sija in #588
⚠️ - Raise on invalid file path by @veelenga & @Sija in #827
⚠️ - Ignore blank values in CLI flags by @Sija in #757
⚠️ - Fix
Formatter::DotFormatterfailures count by @Sija in #530 - Do not autocorrect disabled issues by @veelenga in #783
- Fix specs to support Crystal 1.17 by @Sija in #628
- Fix specs for Crystal 1.19.0 by @Sija in #749
- Fix
selectexpression omissions by @Sija in #629 - Fix missing logic for block arguments by @Sija in #670
- Fix Git SHA command for Windows by @SunP04 in #667
- Windows related fixes by @Sija in #677
- Fix CodeQL issues by @Sija in #707
- Make sure to return
Boolfrom#visitmethods by @Sija in #715 - Correctly reset location-less node scope in
AST::ScopeVisitorby @Sija in #806 - Fix
--fail-levelCLI switch not having any effect by @Sija in #759 - Revert "Fix
--fail-levelCLI switch not having any effect" by @Sija in #760 - Potential fix for 1 code quality finding by @nobodywasishere in #775
- Fix edgecase in
Formatter::Util#affected_codelocation marker display logic by @Sija in #813 - Always preserve excluded files in config by @Sija in #841
- Fix typos in docs by @Sija in #863
- Fix language mistakes by @Sija in #874
- Fix
AST::Util#loop?method by @Sija in #888
Refactors
- Add
AST::ImplicitReturnVisitorby @nobodywasishere & @Sija in #507, #533, #537, #549, #551, #552, #553, #563, #584, #646, #770 - In case scope queue is empty call the rule with the current scope by @Sija in #544
- Refactors before 1.7 release by @Sija in #555
- Refactor newly added rules' specs by @Sija in #561
- Refactor recent
Lint/Unused*specs by @nobodywasishere in #562 - Tweak
Lint/LiteralInConditionrule by @Sija in #577 - Misc refactors by @Sija in #599, #729
- Constantinize issue messages in
Lint/RedundantWithIndexrule by @Sija in #637 - Spec tweaks by @Sija in #650
- Add
Ext::Location#same_line?helper method by @Sija in #651 - Make
Rule::Base#hashtake#groupinto account by @Sija in #652 - Simplify adding issues for node names by @Sija in #665
- Remove trailing dot from issue messages by @Sija in #671
- Codebase cleanups by @Sija in #682
- Tweak
Lint/Typosrule by @Sija in #683 - Add
AST::Util#operator_method{_name}?by @Sija in #691 - Add documentation urls by @Sija in #706
- More tweaks by @Sija in #708, #709
- CLI and
Configrefactors by @Sija in #713 - Refactor
Crystal::Callarguments existence checking logic by @Sija in #717 - Revert to the previous implementation of
Lint/Typosrule by @Sija in #719 - Normalize relative source paths by stripping the
./prefix by @Sija in #728 - Moar polish by @Sija in #734, #738, #740, #811, #881
- Add
Ameba::Versionby @Sija in #755 - JSON formatter tweaks by @Sija in #762
- Assorted tweaks by @Sija in #726, #778
- Support constants in type declarations by @Sija in #828
- Add
Source#project_pathproperty by @Sija in #849, #853 - Tweak version presentation logic by @Sija in #856, #858, #859
Infrastructure
- Drop support for Crystal < 1.17 by @Sija in #678
⚠️ - Drop support for Crystal < 1.19 by @Sija in #802
⚠️ - Skip auto compilation (drops
postinstallscript) by @Sija in #741⚠️ - Don’t install
bin/ameba.crexecutable by @Sija in #807⚠️ - Add
.vscodeand.zedfolders to.gitignoreby @nobodywasishere in #564 - Restructure Ameba Distribution by @Sija in #470
- Windows compatibility by @Sija in #668
- Add Windows CI support by @Sija in #673
- Add “Update JSON Schema” CI workflow by @Sija in #686
- Run “Update JSON Schema” CI workflow via GitHub App by @Sija in #688
- CI workflow tweaks by @Sija in #693
- Tweak CI workflows by @Sija in #705
- Build Docker image with the
--releaseflag by @Sija in #730, #731 - Do not use quotes for
CRFLAGSbuild argument by @Sija in #732 - Add
_typos.tomlconfiguration file by @Sija in #681 - Rename
_typos.tomlto.typos.tomlby @Sija in #764 - Add “Spell checker” CI workflow by @Sija in #742
- Add release workflow to build/upload on release tags by @ysbaddaden in #789
- Test minimal supported Crystal version in CI by @Sija in #822
- Support Crystal v1.21 by @Sija in #823, #866
- Enable the
Style/CallParenthesesrule in Ameba repo by @Sija in #844 - Tweak CI release workflow by @Sija in #848
- Add git commit to the Ameba version in the Docker image by @Sija in #852
- Skip CI on automated JSON Schema updates by @Sija in #855
- Sort doc version index upon addition by @Sija in #857
- Raise a compile-time error on invalid build version by @Sija in #864
- Point urls to the new
crystal-ameba.orgdomain by @Sija in #876 - Point documentation urls to the new
/apipath by @Sija in #877 - Use the new
/apipath prefix in docs CI workflows by @Sija in #879 - Add a contributing guide by @Sija in #878
- Add
SECURITY.mdby @Sija in #880
Dependabot
- Bump rlespinasse/github-slug-action from 4 to 5 by @dependabot[bot] in #491
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #656
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #703
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #744
- Bump actions/checkout from 6 to 7 by @dependabot[bot] in #861
- Bump docker/login-action from 3 to 4 by @dependabot[bot] in #790
- Bump docker/setup-qemu-action from 3 to 4 by @dependabot[bot] in #791
- Bump docker/build-push-action from 6 to 7 by @dependabot[bot] in #792
- Bump docker/metadata-action from 5 to 6 by @dependabot[bot] in #793
- Bump docker/setup-buildx-action from 3 to 4 by @dependabot[bot] in #794
New Contributors
- @SunP04 made their first contribution in #667
- @ysbaddaden made their first contribution in #789
- @SAY-5 made their first contribution in #832
Warning
Requires Crystal 1.19.0
Full Changelog: v1.6.4...v1.7.0