File template.rb
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_support/all"
def install_standalone
set_ruby_version
Method modify_article_service
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def modify_article_service(namespace = nil)
article_service =
if namespace
"admin/app/services/admin/article_service.rb"
else
Method install_engine
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install_engine
set_ruby_version
run_ruby_script("bin/rails plugin new admin --mountable")
Method generate_models
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_models
generate(:model, "author name:string")
generate(:model, "article title:string body:text author:references published:boolean published_at:datetime")
gsub_file Dir.glob("db/migrate/*_create_articles.rb").first, "t.boolean :published", "t.boolean :published, default: false"
Similar blocks of code found in 2 locations. Consider refactoring. Open
def modify_author_service(namespace = nil)
author_service =
if namespace
"admin/app/services/admin/author_service.rb"
else
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 34.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def modify_article_service(namespace = nil)
article_service =
if namespace
"admin/app/services/admin/article_service.rb"
else
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 34.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
unexpected token tIDENTIFIER
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
It is generated by running `rake sandbox:deploy` inside the Godmin repo.
- Exclude checks
unexpected token tIDENTIFIER
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
It is generated by running `rake sandbox:deploy` inside the Godmin repo.
- Exclude checks
unexpected token tLSHFT
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
readme_text = <<~README
- Exclude checks
unknown regexp options: gthb
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
This is the source code for a demo application of the [Godmin](https://github.com/varvet/godmin) admin framework for Rails.
- Exclude checks
unexpected token tRPAREN
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
This is the source code for a demo application of the [Godmin](https://github.com/varvet/godmin) admin framework for Rails.
- Exclude checks
unexpected token tIDENTIFIER
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
This is the source code for a demo application of the [Godmin](https://github.com/varvet/godmin) admin framework for Rails.
- Exclude checks
unexpected token tLPAREN2
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
This is the source code for a demo application of the [Godmin](https://github.com/varvet/godmin) admin framework for Rails.
- Exclude checks