toshogakari/eLib

View on GitHub

Showing 14 of 14 total issues

Method search has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def self.search(params, queries)
      if params.blank? or queries.blank?
        return self.all
      end
      arel = self.arel_table
Severity: Minor
Found in app/models/concerns/searchable.rb - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {book} = this.props;
    return (
      <div className="col-sm-6 col-md-4 col-lg-3">
        <div className="row article-item">
Severity: Minor
Found in app/assets/javascripts/components/components/Book.js - About 1 hr to fix

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def create
        @tag = Tag.new(tag_params)
    
        respond_to do |format|
          if @tag.save
    Severity: Major
    Found in app/controllers/tags_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/books_controller.rb on lines 26..35
    app/controllers/categories_controller.rb on lines 26..35
    app/controllers/jobs_controller.rb on lines 26..35
    app/controllers/notes_controller.rb on lines 26..35
    app/controllers/skills_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def create
        @job = Job.new(job_params)
    
        respond_to do |format|
          if @job.save
    Severity: Major
    Found in app/controllers/jobs_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/books_controller.rb on lines 26..35
    app/controllers/categories_controller.rb on lines 26..35
    app/controllers/notes_controller.rb on lines 26..35
    app/controllers/skills_controller.rb on lines 26..35
    app/controllers/tags_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def create
        @skill = Skill.new(skill_params)
    
        respond_to do |format|
          if @skill.save
    Severity: Major
    Found in app/controllers/skills_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/books_controller.rb on lines 26..35
    app/controllers/categories_controller.rb on lines 26..35
    app/controllers/jobs_controller.rb on lines 26..35
    app/controllers/notes_controller.rb on lines 26..35
    app/controllers/tags_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def create
        @book = Book.new(book_params)
    
        respond_to do |format|
          if @book.save
    Severity: Major
    Found in app/controllers/books_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/categories_controller.rb on lines 26..35
    app/controllers/jobs_controller.rb on lines 26..35
    app/controllers/notes_controller.rb on lines 26..35
    app/controllers/skills_controller.rb on lines 26..35
    app/controllers/tags_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def create
        @category = Category.new(category_params)
    
        respond_to do |format|
          if @category.save
    Severity: Major
    Found in app/controllers/categories_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/books_controller.rb on lines 26..35
    app/controllers/jobs_controller.rb on lines 26..35
    app/controllers/notes_controller.rb on lines 26..35
    app/controllers/skills_controller.rb on lines 26..35
    app/controllers/tags_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def create
        @note = Note.new(note_params)
    
        respond_to do |format|
          if @note.save
    Severity: Major
    Found in app/controllers/notes_controller.rb and 5 other locations - About 1 hr to fix
    app/controllers/books_controller.rb on lines 26..35
    app/controllers/categories_controller.rb on lines 26..35
    app/controllers/jobs_controller.rb on lines 26..35
    app/controllers/skills_controller.rb on lines 26..35
    app/controllers/tags_controller.rb on lines 26..35

    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 47.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @skill.update(skill_params)
            format.html { redirect_to @skill, notice: 'Skill was successfully updated.' }
            format.json { render :show, status: :ok, location: @skill }
    Severity: Major
    Found in app/controllers/skills_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/books_controller.rb on lines 42..49
    app/controllers/categories_controller.rb on lines 42..49
    app/controllers/jobs_controller.rb on lines 42..49
    app/controllers/notes_controller.rb on lines 42..49
    app/controllers/tags_controller.rb on lines 42..49

    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 44.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @tag.update(tag_params)
            format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }
            format.json { render :show, status: :ok, location: @tag }
    Severity: Major
    Found in app/controllers/tags_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/books_controller.rb on lines 42..49
    app/controllers/categories_controller.rb on lines 42..49
    app/controllers/jobs_controller.rb on lines 42..49
    app/controllers/notes_controller.rb on lines 42..49
    app/controllers/skills_controller.rb on lines 42..49

    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 44.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @note.update(note_params)
            format.html { redirect_to @note, notice: 'Note was successfully updated.' }
            format.json { render :show, status: :ok, location: @note }
    Severity: Major
    Found in app/controllers/notes_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/books_controller.rb on lines 42..49
    app/controllers/categories_controller.rb on lines 42..49
    app/controllers/jobs_controller.rb on lines 42..49
    app/controllers/skills_controller.rb on lines 42..49
    app/controllers/tags_controller.rb on lines 42..49

    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 44.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @category.update(category_params)
            format.html { redirect_to @category, notice: 'Category was successfully updated.' }
            format.json { render :show, status: :ok, location: @category }
    Severity: Major
    Found in app/controllers/categories_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/books_controller.rb on lines 42..49
    app/controllers/jobs_controller.rb on lines 42..49
    app/controllers/notes_controller.rb on lines 42..49
    app/controllers/skills_controller.rb on lines 42..49
    app/controllers/tags_controller.rb on lines 42..49

    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 44.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @book.update(book_params)
            format.html { redirect_to @book, notice: 'Book was successfully updated.' }
            format.json { render :show, status: :ok, location: @book }
    Severity: Major
    Found in app/controllers/books_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/categories_controller.rb on lines 42..49
    app/controllers/jobs_controller.rb on lines 42..49
    app/controllers/notes_controller.rb on lines 42..49
    app/controllers/skills_controller.rb on lines 42..49
    app/controllers/tags_controller.rb on lines 42..49

    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 44.

    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 6 locations. Consider refactoring.
    Open

      def update
        respond_to do |format|
          if @job.update(job_params)
            format.html { redirect_to @job, notice: 'Job was successfully updated.' }
            format.json { render :show, status: :ok, location: @job }
    Severity: Major
    Found in app/controllers/jobs_controller.rb and 5 other locations - About 55 mins to fix
    app/controllers/books_controller.rb on lines 42..49
    app/controllers/categories_controller.rb on lines 42..49
    app/controllers/notes_controller.rb on lines 42..49
    app/controllers/skills_controller.rb on lines 42..49
    app/controllers/tags_controller.rb on lines 42..49

    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 44.

    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

    Severity
    Category
    Status
    Source
    Language