code_optimization 0.1.2 → 0.1.3

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: 443e6712d40380b5a80cae0be739960e1dfd79e2b11c950bc05ec2f95f855fa0
4
- data.tar.gz: e80c395a83594fe217f70cc766fd2a3113fa730845c1782a4383a62a87ba55ee
3
+ metadata.gz: 7eda2d81c66f83071573ed4fa2ff6e617ceb91d50d5bbc9f905ddea79309c9fb
4
+ data.tar.gz: 2c6bdb4f057700f039bc2e863ea3fa6df8d54affb62f021311dbdc14dc225af8
5
5
  SHA512:
6
- metadata.gz: e9598487951e2a633678f2df41c46307d6f614246c22289df2576c2636ec2e976e1750ab1af8471ae3e9db97104751de9bf592b3d613e63412d2fdf4da2702d0
7
- data.tar.gz: e201e36f2cb4b4b57f4a63fde67201e0cdd6b3b469a6ed442e0442643ff21843198b58071ad8d5ec1bb99d3095ea89f905f2dc7c206a940492da809eaaa2dd47
6
+ metadata.gz: c5c3928ca5fb83b6505517b87d58d968cfc9c2bf098bdab2c25ea14de9f34add74cdebaeb411ea478cae1b882fa907fcecebef8eae32d982f2715cedf9233646
7
+ data.tar.gz: 7ccde5b1034dc456ce210f47abe1660812ee49189e8692bd84e993a2ae45a7228760144d3bd567b97681f42aae918b5e85bd51bf9e0aa6ba0bfd53f4a8a1a788
@@ -0,0 +1,153 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ code_optimization (0.1.1)
5
+ brakeman
6
+ bullet
7
+ rack-mini-profiler
8
+ rails_best_practices
9
+ rubocop
10
+ rubycritic
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (6.0.3.2)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 0.7, < 2)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ zeitwerk (~> 2.2, >= 2.2.2)
21
+ addressable (2.7.0)
22
+ public_suffix (>= 2.0.2, < 5.0)
23
+ ast (2.4.1)
24
+ axiom-types (0.1.1)
25
+ descendants_tracker (~> 0.0.4)
26
+ ice_nine (~> 0.11.0)
27
+ thread_safe (~> 0.3, >= 0.3.1)
28
+ brakeman (4.8.2)
29
+ bullet (6.1.0)
30
+ activesupport (>= 3.0.0)
31
+ uniform_notifier (~> 1.11)
32
+ code_analyzer (0.5.2)
33
+ sexp_processor
34
+ coercible (1.0.0)
35
+ descendants_tracker (~> 0.0.1)
36
+ concurrent-ruby (1.1.6)
37
+ descendants_tracker (0.0.4)
38
+ thread_safe (~> 0.3, >= 0.3.1)
39
+ diff-lcs (1.4.4)
40
+ docile (1.3.2)
41
+ equalizer (0.0.11)
42
+ erubis (2.7.0)
43
+ flay (2.12.1)
44
+ erubis (~> 2.7.0)
45
+ path_expander (~> 1.0)
46
+ ruby_parser (~> 3.0)
47
+ sexp_processor (~> 4.0)
48
+ flog (4.6.4)
49
+ path_expander (~> 1.0)
50
+ ruby_parser (~> 3.1, > 3.1.0)
51
+ sexp_processor (~> 4.8)
52
+ i18n (1.8.3)
53
+ concurrent-ruby (~> 1.0)
54
+ ice_nine (0.11.2)
55
+ json (2.3.1)
56
+ kwalify (0.7.2)
57
+ launchy (2.5.0)
58
+ addressable (~> 2.7)
59
+ minitest (5.14.1)
60
+ parallel (1.19.2)
61
+ parser (2.7.1.4)
62
+ ast (~> 2.4.1)
63
+ path_expander (1.1.0)
64
+ psych (3.1.0)
65
+ public_suffix (4.0.5)
66
+ rack (2.2.3)
67
+ rack-mini-profiler (2.0.2)
68
+ rack (>= 1.2.0)
69
+ rails_best_practices (1.20.0)
70
+ activesupport
71
+ code_analyzer (>= 0.5.1)
72
+ erubis
73
+ i18n
74
+ json
75
+ require_all (~> 3.0)
76
+ ruby-progressbar
77
+ rainbow (3.0.0)
78
+ rake (13.0.1)
79
+ reek (6.0.1)
80
+ kwalify (~> 0.7.0)
81
+ parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
82
+ psych (~> 3.1.0)
83
+ rainbow (>= 2.0, < 4.0)
84
+ regexp_parser (1.7.1)
85
+ require_all (3.0.0)
86
+ rexml (3.2.4)
87
+ rspec (3.9.0)
88
+ rspec-core (~> 3.9.0)
89
+ rspec-expectations (~> 3.9.0)
90
+ rspec-mocks (~> 3.9.0)
91
+ rspec-core (3.9.2)
92
+ rspec-support (~> 3.9.3)
93
+ rspec-expectations (3.9.2)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.9.0)
96
+ rspec-mocks (3.9.1)
97
+ diff-lcs (>= 1.2.0, < 2.0)
98
+ rspec-support (~> 3.9.0)
99
+ rspec-support (3.9.3)
100
+ rubocop (0.86.0)
101
+ parallel (~> 1.10)
102
+ parser (>= 2.7.0.1)
103
+ rainbow (>= 2.2.2, < 4.0)
104
+ regexp_parser (>= 1.7)
105
+ rexml
106
+ rubocop-ast (>= 0.0.3, < 1.0)
107
+ ruby-progressbar (~> 1.7)
108
+ unicode-display_width (>= 1.4.0, < 2.0)
109
+ rubocop-ast (0.1.0)
110
+ parser (>= 2.7.0.1)
111
+ ruby-progressbar (1.10.1)
112
+ ruby_parser (3.14.2)
113
+ sexp_processor (~> 4.9)
114
+ rubycritic (4.5.1)
115
+ flay (~> 2.8)
116
+ flog (~> 4.4)
117
+ launchy (>= 2.0.0)
118
+ parser (>= 2.6.0)
119
+ rainbow (~> 3.0)
120
+ reek (~> 6.0, < 7.0)
121
+ ruby_parser (~> 3.8)
122
+ simplecov (>= 0.17.0)
123
+ tty-which (~> 0.4.0)
124
+ virtus (~> 1.0)
125
+ sexp_processor (4.15.0)
126
+ simplecov (0.18.5)
127
+ docile (~> 1.1)
128
+ simplecov-html (~> 0.11)
129
+ simplecov-html (0.12.2)
130
+ thread_safe (0.3.6)
131
+ tty-which (0.4.2)
132
+ tzinfo (1.2.7)
133
+ thread_safe (~> 0.1)
134
+ unicode-display_width (1.7.0)
135
+ uniform_notifier (1.13.0)
136
+ virtus (1.0.5)
137
+ axiom-types (~> 0.1)
138
+ coercible (~> 1.0)
139
+ descendants_tracker (~> 0.0, >= 0.0.3)
140
+ equalizer (~> 0.0, >= 0.0.9)
141
+ zeitwerk (2.3.1)
142
+
143
+ PLATFORMS
144
+ ruby
145
+
146
+ DEPENDENCIES
147
+ bundler (~> 1.16)
148
+ code_optimization!
149
+ rake (~> 13.0)
150
+ rspec (~> 3.0)
151
+
152
+ BUNDLED WITH
153
+ 1.17.2
data/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # CodeOptimization
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/code_optimization`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ The best way to write a code called as code optimization. The best ways are ruby styleguide, rails styleguide, code reusability, without code duplication, without security vulnerabilities and without N+1 queries. The above each and every best ways are have some libraries.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Combination Of Below Gems
6
+
7
+ 1. OVERCOMMIT(Git Hook Manager)
8
+ 2. RUBOCOP(STATIC CODE ANALYSIS)
9
+ 3. BULLET(N+1 Query)
10
+ 4. BRAKEMAN(SECURITY SCANNER FOR ROR APPLICATION)
11
+ 5. Rack Mini profiler(Middleware that displays speed badge)
12
+ 6. Rails Best Practises(Rails Code Analysis Tool)
13
+ 7. RubyCritic(Ruby Code quality reporter)
6
14
 
7
15
  ## Installation
8
16
 
@@ -19,6 +27,10 @@ And then execute:
19
27
  Or install it yourself as:
20
28
 
21
29
  $ gem install code_optimization
30
+
31
+ ## SETUP Details are Below
32
+
33
+ [Code Optimization Document](https://github.com/honestveera/code_optimization/blob/master/code_optimization.md).
22
34
 
23
35
  ## Usage
24
36
 
@@ -32,7 +44,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
44
 
33
45
  ## Contributing
34
46
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/code_optimization. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/honestveera/code_optimization. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
48
 
37
49
  ## License
38
50
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
29
  spec.add_dependency "brakeman"
30
30
  spec.add_dependency "bullet"
@@ -0,0 +1,97 @@
1
+ # CODE OPTIMIZATION
2
+
3
+ The best way to write a code called as code optimization. The best ways is ruby styleguide, rails styleguide, code reusability, without code duplication, without security vulnerabilities and without N+1 queries. The above each and every best ways are have some libraries.
4
+
5
+ # Installation
6
+
7
+ Using Bundler:
8
+
9
+ group :development do
10
+ gem 'brakeman' # Security Analysis Tool
11
+ gem 'bullet' # Find N+1 Queries
12
+ gem 'overcommit' # Manage and configure Git hooks.
13
+ gem 'rails_best_practices' # Rails Code Analysis Tool
14
+ gem 'rack-mini-profiler' #Query Loading
15
+ gem 'rubocop' # Ruby Static Code Analyser #https://github.com/rubocop-hq/rubocop/edit/master/config/default.yml
16
+ gem 'rubycritic' # Code Reusability and Find Code duplications#
17
+ end
18
+
19
+ # OVERCOMMIT(Git Hook Manager)
20
+
21
+ 1. bundle install
22
+ 2. overcommit --sign
23
+ 3. git add file1,file2,file3
24
+ 4. git commit -m "Test message"
25
+ 5. Please check below messages are coming or not
26
+
27
+ Running pre-commit hooks: Example
28
+
29
+ Analyze with RailsBestPractices..................[RailsBestPractices] OK
30
+ Analyze with RuboCop........................................[RuboCop] OK
31
+ ✓ All pre-commit hooks passed
32
+ Running commit-msg hooks
33
+ Check text width..........................................[TextWidth] OK
34
+ Check subject capitalization.....................[CapitalizedSubject] WARNING
35
+
36
+ Subject should start with a capital letter
37
+ Check subject line................................[SingleLineSubject] OK
38
+ Check for trailing periods in subject................[TrailingPeriod] OK
39
+
40
+ ⚠ All commit-msg hooks passed, but with warnings
41
+
42
+ # RUBOCOP(STATIC CODE ANALYSIS)
43
+
44
+ 1. `rubocop .` (It will scan whole projects *.rb)
45
+ 2. `rubocop file_path` (Analyse only particular .rb file).
46
+ 3. How to auto_correct particular file?
47
+
48
+ `rubocop file_path ----safe-auto-correct`
49
+
50
+ # BULLET(N+1 Query)
51
+ 1.Please config this for below `config/environments/development.rb`
52
+
53
+ config.after_initialize do
54
+ Bullet.enable = true
55
+ Bullet.alert = true
56
+ Bullet.bullet_logger = true
57
+ Bullet.console = true
58
+ Bullet.growl = true
59
+ Bullet.rails_logger = true
60
+ end
61
+
62
+ # BRAKEMAN(SECURITY SCANNER FOR ROR APPLICATION)
63
+ 1. Please chack all useful commands of brakeman
64
+
65
+ brakeman
66
+ brakeman -o output_filename.html [It will return output for CSV,JSON OR HTML]
67
+ brakeman -t SQL,ValidationRegex [Only run a certain set of tests]
68
+ brakeman -x DefaultRoutes,Redirect [Can skip particular validation]
69
+ brakeman --skip-files file1,/path1/,path2/ [Do skip certain file OR Directory]
70
+ brakeman --compare old_report.json [We can compare old results with new results]
71
+ Warning Types: https://github.com/presidentbeef/brakeman/tree/master/docs/warning_types
72
+
73
+ # Rack Mini profiler(Middleware that displays speed badge)
74
+ 1. Middleware that displays speed badge for every html page
75
+ 2. Designed to work both in production and in development.
76
+
77
+ # Rails Best Practises(Rails Code Analysis Tool)
78
+ 1. Please check the useful commands
79
+ 2. It will check rails principle COC(convention over configuration) and DRY(Dont repeat yourself)
80
+
81
+ rails_best_practises --help
82
+ rails_best_practises .
83
+
84
+ # RubyCritic(Ruby Code quality reporter)
85
+ 1.Code Reusability and Find Code duplications.This is a combination of Flay,Flog and Reek.
86
+
87
+ Reek - Reek is a tool that examines Ruby classes, modules and methods and reports any Code Smells it finds.
88
+ Flay - Flay analyzes code for structural similarities.
89
+ Flog - Flog reports the most tortured code in an easy to read pain report
90
+
91
+ rubycritic
92
+ rubycritic lib/foo.rb
93
+ (OR)
94
+ reek
95
+ flay
96
+ flog
97
+
@@ -1,3 +1,3 @@
1
1
  module CodeOptimization
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_optimization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honestraj Kandhasamy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2020-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -151,12 +151,14 @@ files:
151
151
  - ".travis.yml"
152
152
  - CODE_OF_CONDUCT.md
153
153
  - Gemfile
154
+ - Gemfile.lock
154
155
  - LICENSE.txt
155
156
  - README.md
156
157
  - Rakefile
157
158
  - bin/console
158
159
  - bin/setup
159
160
  - code_optimization.gemspec
161
+ - code_optimization.md
160
162
  - lib/code_optimization.rb
161
163
  - lib/code_optimization/version.rb
162
164
  homepage: https://rubygems.org/gems/code_optimization