code_quality_check 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: edb86571d044e7e3a130c8f2c0c560956b58dc06c336d6cb1f9cda8b2cff431f
4
+ data.tar.gz: b7c498902c58ebd212f9672c94a462d4582738fdba2612f56f987b6afd9a6ec8
5
+ SHA512:
6
+ metadata.gz: 5e8a5a900428d2edfe59b5a316fd2644783e60fb1d101fc042be6516cbb0967892464238901c0099447700123c9cab7bb301534ed0b01813545124b60b314731
7
+ data.tar.gz: c360645a474d5b2d657d8fc29c40bf1d6fcc890889a211349ceab772c8086d58e5d342f3189cd873080452e5208c5f09e11e5d0d36b430c47e82ad805681614e
@@ -0,0 +1,3 @@
1
+ module CodeQualityCheck
2
+ VERSION = "0.1.0".freeze
3
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'code_quality_check/version'
4
+ module CodeQualityCheck
5
+ class Error < StandardError; end
6
+ end
File without changes
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/base'
4
+
5
+ module CodeQualityCheck
6
+ module Generators
7
+ # Define a generator class that inherits from Rails::Generators::Base
8
+ class InstallGenerator < Rails::Generators::Base
9
+ source_root File.expand_path('templates', __dir__)
10
+ desc 'This generator creates an initializer file for Overcommit'
11
+
12
+ # Define a method that copies the initializer file to the config/initializers directory
13
+ def copy_required_files
14
+ # Copy the initializer file to the config/initializers directory
15
+ template 'overcommit.rb', 'config/initializers/overcommit.rb'
16
+
17
+ # Copy the Overcommit configuration file to the root directory
18
+ template '.overcommit.yml', '.overcommit.yml'
19
+
20
+ # Copy the RuboCop configuration file to the root directory
21
+ template '.rubocop.yml', '.rubocop.yml'
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ # config/initializers/overcommit.rb
2
+
3
+ if Rails.env.development? || Rails.env.test?
4
+ begin
5
+ # Check if Overcommit is already installed by verifying the pre-commit hook
6
+ if File.exist?(File.join(Rails.root, '.git/hooks/pre-commit'))
7
+ puts 'Overcommit is already installed.'
8
+ else
9
+ puts 'Installing Overcommit hooks...'
10
+ system('bundle exec overcommit --install')
11
+ system('overcommit --sign')
12
+ system('overcommit --sign pre-commit')
13
+ end
14
+ rescue StandardError => e
15
+ # Log or print any error that occurs
16
+ Rails.logger.error "Overcommit installation failed: #{e.message}"
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ # lib/generators/code_quality_check/uninstall_generator.rb
2
+ require 'rails/generators/base'
3
+
4
+ module CodeQualityCheck
5
+ module Generators
6
+ class UninstallGenerator < Rails::Generators::Base
7
+ desc 'This generator removes Overcommit and RuboCop configuration files'
8
+
9
+ def remove_files
10
+ # List of files to be removed
11
+ files_to_remove = [
12
+ 'config/initializers/overcommit.rb',
13
+ '.overcommit.yml',
14
+ '.rubocop.yml'
15
+ ]
16
+
17
+ files_to_remove.each do |file|
18
+ if File.exist?(file)
19
+ remove_file file
20
+ say_status('removed', file)
21
+ else
22
+ say_status('not found', file, :yellow)
23
+ end
24
+ end
25
+ end
26
+
27
+ def uninstall_overcommit
28
+ # uninstall overcommit
29
+ run 'bundle exec overcommit --uninstall'
30
+ end
31
+ end
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: code_quality_check
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aniruddha Mirajkar
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: brakeman
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails_best_practices
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.23.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.23.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.21'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.21'
55
+ description: Integrates Overcommit with RuboCop, Rails Best Practices, and Brakeman
56
+ for automated code quality checks.
57
+ email:
58
+ - mirajkaraniruddha@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - lib/code_quality_check.rb
64
+ - lib/code_quality_check.rb:Zone.Identifier
65
+ - lib/code_quality_check/version.rb
66
+ - lib/code_quality_check/version.rb:Zone.Identifier
67
+ - lib/generators/code_quality_check/install_generator.rb
68
+ - lib/generators/code_quality_check/install_generator.rb:Zone.Identifier
69
+ - lib/generators/code_quality_check/templates/overcommit.rb
70
+ - lib/generators/code_quality_check/templates/overcommit.rb:Zone.Identifier
71
+ - lib/generators/code_quality_check/uninstall_generator.rb
72
+ - lib/generators/code_quality_check/uninstall_generator.rb:Zone.Identifier
73
+ homepage: https://github.com/yourusername/code_quality_check
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubygems_version: 3.4.1
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: A gem to enforce code quality checks using Git hooks
96
+ test_files: []