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

Enable ameba linter #14631

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .ameba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Global

Excluded:
- src/unicode/data.cr
- src/openssl/lib_crypto.cr

# Metrics

Metrics/CyclomaticComplexity:
Enabled: false

# Documentation

Documentation/DocumentationAdmonition:
Enabled: false

# Naming

Naming/BlockParameterName:
Enabled: false

Naming/BinaryOperatorParameterName:
Enabled: false

Naming/ConstantNames:
Excluded:
- src/lib_c/x86_64-windows-msvc/**/*
- src/lib_c/aarch64-android/**/*

Naming/TypeNames:
Excluded:
- src/lib_c/**/*
- src/llvm/abi/**/*
- src/float/printer/**/*
- src/time/format/custom/**/*

Naming/MethodNames:
Excluded:
- samples/spectral-norm.cr
- src/crystal/system/win32/time.cr

Naming/VariableNames:
Excluded:
- samples/spectral-norm.cr
- src/lib_c/**/*
- src/float/printer/**/*
- src/crystal/system/win32/time.cr
- src/crystal/system/win32/delay_load.cr
- src/xml/libxml2.cr

# Lint

Lint/Typos:
Enabled: false

Lint/ShadowingOuterLocalVar:
Enabled: false

Lint/NotNil:
Enabled: false

Lint/UnusedArgument:
Enabled: false

Lint/DebuggerStatement:
Excluded:
- spec/debug/**/*

Lint/DebugCalls:
Excluded:
- scripts/generate_windows_zone_names.cr
- samples/**/*
- spec/std/pp_spec.cr
- src/kernel.cr

Lint/UselessAssign:
Excluded:
- scripts/generate_grapheme_properties.cr
- scripts/generate_unicode_data.cr
- samples/mt_gc_test.cr
- spec/debug/**/*
- spec/std/concurrent/select_spec.cr
- spec/std/weak_ref_spec.cr
- src/crystal/system/unix/syscall.cr

Lint/LiteralInInterpolation:
Excluded:
- spec/compiler/formatter/formatter_spec.cr
- spec/std/string_spec.cr
- spec/std/random_spec.cr

Lint/LiteralInCondition:
Excluded:
- spec/std/range_spec.cr

Lint/LiteralsComparison:
Excluded:
- spec/std/int_spec.cr
- spec/std/tuple_spec.cr
- spec/std/char_spec.cr
- spec/std/regex_spec.cr

Lint/RandZero:
Excluded:
- spec/std/random_spec.cr

Lint/SpecFocus:
Excluded:
- spec/compiler/parser/parser_spec.cr

Lint/SpecFilename:
Excluded:
- spec/llvm-ir/**/*
- spec/compiler/crystal_path/**/*

# Style

Style/WhileTrue:
Enabled: false

Style/NegatedConditionsInUnless:
Enabled: false

Style/VerboseBlock:
ExcludeOperators: true
ExcludeSetters: true

Style/RedundantNext:
Excluded:
- src/crystal/system/win32/**/*
17 changes: 17 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ jobs:
- name: Check Format
run: bin/ci format

run_ameba:
runs-on: ubuntu-latest
steps:
- name: Install latest Crystal version
uses: crystal-lang/install-crystal@v1
with:
crystal: latest

- name: Download Crystal source
uses: actions/checkout@v4

- name: Install dependencies
run: shards install

- name: Run Ameba linter
run: bin/ameba

deploy_api_docs:
if: github.repository_owner == 'crystal-lang' && github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
Expand Down
4 changes: 4 additions & 0 deletions shard.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
version: 2.0
shards:
ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.6.1+git.commit.6d03cef6dfd0f52faf19bbcd47d14831db4d7834

markd:
git: https://github.com/icyleaf/markd.git
version: 0.5.0
Expand Down
5 changes: 5 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ dependencies:
github: I3oris/reply
commit: 90a7eb5a76048884d5d56bf6b9369f1e67fdbcd7

development_dependencies:
ameba:
github: crystal-ameba/ameba
commit: 6d03cef6dfd0f52faf19bbcd47d14831db4d7834

license: Apache-2.0

repository: https://github.com/crystal-lang/crystal
Expand Down
Loading