code_quality_check 0.1.6 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d7ae4cff95b35c9f984ce1578f97675f6febe7ca1b9c1d37f9c46ece5164c90
4
- data.tar.gz: b823b189b8dc85ed5296162efd4fb3fdcf8bbd6e92a075aa41393b6dc56c5043
3
+ metadata.gz: 5b3681223d5d607cb07faa4c6b927878f16fc16d2507f5c8f7c0e5e3a0dee59e
4
+ data.tar.gz: 8346071348869569cff24a1678df58e15e773d2c9cbbb6599d993e12238cb576
5
5
  SHA512:
6
- metadata.gz: 57b50c71709df027071bfc5f727d698cece3179a471963169c16ebe27895538b972e76e0f16d20e10e8ca3b12f2cd810d0610fbd4a18836d4cfde17f73e0971d
7
- data.tar.gz: b712522bc8f6d26643d1504ff130547557b7f67cf38d6dfea60d8d3179d12b726bc6bdfd2d87da4b3d019224d36c133ab58f2f6aee21c979e9710b354501d7e6
6
+ metadata.gz: 261a40ffcee2ad4de91a7bbe92f95f72474bb8f4728c51615b54c6ed4e1e43dcb638a978e00d2ab1463a222ab511a0283e7924f0a40e66dd7aced332cec9298d
7
+ data.tar.gz: 4e06c4413d9802c5e68a04bfa2c4c7eee850f24cef9a5e0b305054090f031c4aa032e60a4061913bdafb0487b195155c1cd9ab82e24da16b509acaff16d3b780
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version Module.
4
4
  module CodeQualityCheck
5
- VERSION = '0.1.6'
5
+ VERSION = '0.1.9'
6
6
  end
@@ -1,6 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'code_quality_check/version'
4
+
5
+ # CodeQualityCheck integrates RuboCop, Brakeman, and Rails Best Practices
6
+ # with Overcommit to enforce automated code quality checks on every Git commit.
7
+ #
8
+ # @see https://github.com/aniruddhami/code_quality_check
4
9
  module CodeQualityCheck
10
+ # Base error class for CodeQualityCheck gem.
5
11
  class Error < StandardError; end
6
12
  end
@@ -4,7 +4,17 @@ require 'rails/generators/base'
4
4
 
5
5
  module CodeQualityCheck
6
6
  module Generators
7
- # Define a generator class that inherits from Rails::Generators::Base
7
+ # Rails generator that installs Overcommit, RuboCop, Brakeman, and Rails Best
8
+ # Practices configuration files into a Rails project.
9
+ #
10
+ # Run with: +rails generate code_quality_check:install+
11
+ #
12
+ # Creates:
13
+ # - config/initializers/code_quality_check.rb
14
+ # - .overcommit.yml
15
+ # - .rubocop.yml
16
+ # - .git/hooks/pre-commit
17
+ # - .git/hooks/post-checkout
8
18
  class InstallGenerator < Rails::Generators::Base
9
19
  source_root File.expand_path('templates', __dir__)
10
20
  desc 'This generator creates an initializer file for Overcommit'
@@ -17,7 +27,7 @@ module CodeQualityCheck
17
27
  # Define a method that copies the initializer file to the config/initializers directory
18
28
  def copy_required_files
19
29
  # Copy the initializer file to the config/initializers directory
20
- template 'overcommit.rb', 'config/initializers/overcommit.rb'
30
+ template 'code_quality_check.rb', 'config/initializers/code_quality_check.rb'
21
31
 
22
32
  # Copy the Overcommit configuration file to the root directory
23
33
  template 'overcommit.yml', '.overcommit.yml'
@@ -1,4 +1,20 @@
1
- # config/initializers/overcommit.rb
1
+ # config/initializers/code_quality_check.rb
2
+
3
+ # Ensure code_quality_check gem is installed before setting up hooks
4
+ begin
5
+ Gem::Specification.find_by_name('code_quality_check')
6
+ rescue Gem::MissingSpecError
7
+ raise <<~MSG
8
+ The code_quality_check gem is not installed.
9
+
10
+ Add to your Gemfile:
11
+ gem 'code_quality_check'
12
+
13
+ Then run:
14
+ bundle install
15
+ rails generate code_quality_check:install
16
+ MSG
17
+ end
2
18
 
3
19
  if Rails.env.development? || Rails.env.test?
4
20
  begin
@@ -2,18 +2,21 @@
2
2
  # extend the default configuration defined in:
3
3
  # https://github.com/sds/overcommit/blob/master/config/default.yml
4
4
  #
5
- # At the topmost level of this YAML file is a key representing type of hook
6
- # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
- # customize each hook, such as whether to only run it on certain files (via
8
- # `include`), whether to only display output if it fails (via `quiet`), etc.
5
+ # Required gems (add to your Gemfile; code_quality_check provides most):
6
+ # - overcommit
7
+ # - rubocop, rubocop-performance, rubocop-rails
8
+ # - brakeman
9
+ # - rails_best_practices
10
+ # - bundler-audit (for BundleAudit security check)
11
+ #
12
+ # Optional code quality gems (enable hooks below to use):
13
+ # - reek (code smells)
14
+ # - flay (code duplication)
15
+ # - fasterer (performance)
9
16
  #
10
17
  # For a complete list of hooks, see:
11
18
  # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
- #
13
- # For a complete list of options that you can use to customize hooks, see:
14
- # https://github.com/sds/overcommit#configuration
15
- #
16
- # Uncomment the following lines to make the configuration take effect.
19
+ #-------------------------------------------------------------------------------
17
20
 
18
21
  PreCommit:
19
22
  RuboCop:
@@ -38,10 +41,43 @@ PreCommit:
38
41
  # Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications.
39
42
  Brakeman:
40
43
  enabled: true
41
- command: ['brakeman', '--skip-libs', '-w3']
44
+ required_executable: 'brakeman'
45
+ command: ['bundle', 'exec', 'brakeman', '--skip-libs', '-w3']
46
+ description: 'Scanning for security vulnerabilities with Brakeman'
42
47
 
43
- TrailingWhitespace:
48
+ # BundleAudit checks Gemfile.lock for known vulnerable gem versions (CVE database).
49
+ BundleAudit:
50
+ enabled: true
51
+ required_executable: 'bundle-audit'
52
+ description: 'Checking for vulnerable gem versions'
53
+ include:
54
+ - 'Gemfile.lock'
55
+
56
+ # Reek analyzes Ruby code for code smells (add gem 'reek' to enable).
57
+ Reek:
44
58
  enabled: false
59
+ required_executable: 'reek'
60
+ description: 'Detecting code smells with Reek'
61
+ flags: ['--single-line', '--no-color', '--force-exclusion']
62
+ include: '**/*.rb'
63
+
64
+ # Flay finds structural code duplication (add gem 'flay' to enable).
65
+ Flay:
66
+ enabled: false
67
+ required_executable: 'flay'
68
+ description: 'Finding code duplication with Flay'
69
+ mass_threshold: 16
70
+ include: '**/*.rb'
71
+
72
+ # Fasterer suggests Ruby performance improvements (add gem 'fasterer' to enable).
73
+ Fasterer:
74
+ enabled: false
75
+ required_executable: 'fasterer'
76
+ description: 'Analyzing for potential speed improvements'
77
+ include: '**/*.rb'
78
+
79
+ TrailingWhitespace:
80
+ enabled: true
45
81
  exclude:
46
82
  - '**/lib/**/*' # Ignore trailing whitespace in generated files
47
83
 
@@ -4,14 +4,20 @@ require 'rails/generators/base'
4
4
 
5
5
  module CodeQualityCheck
6
6
  module Generators
7
- # Uninstall generator to remove Overcommit and RuboCop configuration files
7
+ # Rails generator that removes CodeQualityCheck configuration and uninstalls
8
+ # Overcommit hooks.
9
+ #
10
+ # Run with: +rails generate code_quality_check:uninstall+
11
+ #
12
+ # Removes: config/initializers/code_quality_check.rb, .overcommit.yml, .rubocop.yml
13
+ # Runs: bundle exec overcommit --uninstall
8
14
  class UninstallGenerator < Rails::Generators::Base
9
15
  desc 'This generator removes Overcommit and RuboCop configuration files'
10
16
 
11
17
  # Remove Overcommit and RuboCop configuration files
12
18
  def remove_files
13
19
  # List of files to be removed
14
- files_to_remove = ['config/initializers/overcommit.rb', '.overcommit.yml', '.rubocop.yml']
20
+ files_to_remove = ['config/initializers/code_quality_check.rb', '.overcommit.yml', '.rubocop.yml']
15
21
 
16
22
  files_to_remove.each do |file|
17
23
  if File.exist?(file)
metadata CHANGED
@@ -1,29 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_quality_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aniruddha Mirajkar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-27 00:00:00.000000000 Z
11
+ date: 2026-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.4'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5.4'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler-audit
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: 5.4.0
39
+ version: '0.9'
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: 5.4.0
46
+ version: '0.9'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: rails_best_practices
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,8 +92,35 @@ dependencies:
72
92
  - - ">="
73
93
  - !ruby/object:Gem::Version
74
94
  version: 1.23.1
75
- description: Integrates Overcommit with RuboCop, Rails Best Practices, and Brakeman
76
- for automated code quality checks.
95
+ - !ruby/object:Gem::Dependency
96
+ name: rails
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '6.0'
102
+ - - "<"
103
+ - !ruby/object:Gem::Version
104
+ version: '9'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '6.0'
112
+ - - "<"
113
+ - !ruby/object:Gem::Version
114
+ version: '9'
115
+ description: |
116
+ Code Quality Check is a Ruby on Rails gem that runs automated quality and security
117
+ checks on every commit using Overcommit and Git hooks. It bundles and configures
118
+ RuboCop (style and lint), Brakeman (security), Rails Best Practices, and
119
+ BundleAudit (CVE checks). The installer sets up a Rails initializer that verifies
120
+ the gem is installed and ensures Overcommit hooks are present, so teams don't
121
+ silently skip checks. Optional support for Reek, Flay, and Fasterer via
122
+ .overcommit.yml. Requires Overcommit in your Gemfile; add the gem and run
123
+ `rails generate code_quality_check:install` to get started.
77
124
  email:
78
125
  - mirajkaraniruddha@gmail.com
79
126
  executables: []
@@ -83,7 +130,7 @@ files:
83
130
  - lib/code_quality_check.rb
84
131
  - lib/code_quality_check/version.rb
85
132
  - lib/generators/code_quality_check/install_generator.rb
86
- - lib/generators/code_quality_check/templates/overcommit.rb
133
+ - lib/generators/code_quality_check/templates/code_quality_check.rb
87
134
  - lib/generators/code_quality_check/templates/overcommit.yml
88
135
  - lib/generators/code_quality_check/templates/post-checkout
89
136
  - lib/generators/code_quality_check/templates/pre-commit
@@ -96,6 +143,7 @@ metadata:
96
143
  homepage_uri: https://github.com/aniruddhami/code_quality_check
97
144
  source_code_uri: https://github.com/aniruddhami/code_quality_check
98
145
  changelog_uri: https://github.com/aniruddhami/code_quality_check/blob/main/CHANGELOG.md
146
+ documentation_uri: https://github.com/aniruddhami/code_quality_check#readme
99
147
  github_repo: https://github.com/aniruddhami/code_quality_check
100
148
  rubygems_mfa_required: 'true'
101
149
  post_install_message:
@@ -116,5 +164,5 @@ requirements: []
116
164
  rubygems_version: 3.4.19
117
165
  signing_key:
118
166
  specification_version: 4
119
- summary: A gem to enforce code quality checks using Git hooks
167
+ summary: Enforce code quality on every commit via Overcommit and Git hooks
120
168
  test_files: []