varvet/godmin

View on GitHub
template.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File template.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "active_support/all"

def install_standalone
  set_ruby_version

Severity: Minor
Found in template.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in template.rb - About 1 hr to fix

      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")
      
      
      Severity: Minor
      Found in template.rb - About 1 hr to fix

        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"
        Severity: Minor
        Found in template.rb - About 1 hr to fix

          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
          Severity: Minor
          Found in template.rb and 1 other location - About 35 mins to fix
          template.rb on lines 221..278

          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

          Further Reading

          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
          Severity: Minor
          Found in template.rb and 1 other location - About 35 mins to fix
          template.rb on lines 282..309

          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

          Further Reading

          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.
          Severity: Minor
          Found in template.rb by rubocop

          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.
          Severity: Minor
          Found in template.rb by rubocop

          unexpected token tLSHFT (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
          Open

            readme_text = <<~README
          Severity: Minor
          Found in template.rb by rubocop

          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.
          Severity: Minor
          Found in template.rb by rubocop

          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.
          Severity: Minor
          Found in template.rb by rubocop

          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.
          Severity: Minor
          Found in template.rb by rubocop

          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.
          Severity: Minor
          Found in template.rb by rubocop

          There are no issues that match your filters.

          Category
          Status