QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub

Showing 184 of 184 total issues

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

  def update
    @saved_search = SavedSearch.find(params[:id])

    respond_to do |format|
      if @saved_search.update_attributes(params[:saved_search])
Severity: Major
Found in app/controllers/saved_searches_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @tag = Tag.find(params[:id])

    respond_to do |format|
      if @tag.update_attributes(params[:tag])
Severity: Major
Found in app/controllers/tags_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @user = User.find(params[:id])

    respond_to do |format|
      if @user.update_attributes(params[:user])
Severity: Major
Found in app/controllers/users_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55

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

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

  def update
    @analysis_script = AnalysisScript.find(params[:id])

    respond_to do |format|
      if @analysis_script.update_attributes(params[:analysis_script])
Severity: Major
Found in app/controllers/analysis_scripts_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @bookmark = Bookmark.find(params[:id])

    respond_to do |format|
      if @bookmark.update_attributes(params[:bookmark])
Severity: Major
Found in app/controllers/bookmarks_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @audio_recording = AudioRecording.find(params[:id])

    respond_to do |format|
      if @audio_recording.update_attributes(params[:audio_recording])
Severity: Major
Found in app/controllers/audio_recordings_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @site = Site.find(params[:id])

    respond_to do |format|
      if @site.update_attributes(params[:site])
Severity: Major
Found in app/controllers/sites_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @permission = Permission.find(params[:id])

    respond_to do |format|
      if @permission.update_attributes(params[:permission])
Severity: Major
Found in app/controllers/permissions_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @audio_event = AudioEvent.find(params[:id])

    respond_to do |format|
      if @audio_event.update_attributes(params[:audio_event])
Severity: Major
Found in app/controllers/audio_events_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @project = Project.find(params[:id])

    respond_to do |format|
      if @project.update_attributes(params[:project])
Severity: Major
Found in app/controllers/projects_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/photos_controller.rb on lines 56..63
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

  def update
    @photo = Photo.find(params[:id])

    respond_to do |format|
      if @photo.update_attributes(params[:photo])
Severity: Major
Found in app/controllers/photos_controller.rb and 13 other locations - About 30 mins to fix
app/controllers/analysis_items_controller.rb on lines 53..60
app/controllers/analysis_jobs_controller.rb on lines 53..60
app/controllers/analysis_scripts_controller.rb on lines 53..60
app/controllers/audio_events_controller.rb on lines 53..60
app/controllers/audio_recordings_controller.rb on lines 64..71
app/controllers/bookmarks_controller.rb on lines 53..60
app/controllers/permissions_controller.rb on lines 53..60
app/controllers/progresses_controller.rb on lines 53..60
app/controllers/projects_controller.rb on lines 53..60
app/controllers/saved_searches_controller.rb on lines 53..60
app/controllers/sites_controller.rb on lines 53..60
app/controllers/tags_controller.rb on lines 48..55
app/controllers/users_controller.rb on lines 53..60

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

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

Method check_file_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.check_file_hash(file_path, audio_recording)
    # ensure this audio recording needs to be checked
    return if audio_recording.status != :to_check

    # type of hash is at start of hash_to_compare, split using two colons
Severity: Minor
Found in lib/modules/file_cacher.rb - About 25 mins 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 indexOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    Array.prototype.indexOf = function (what, i) {
        i = i || 0;
        var L = this.length;
        while (i < L) {
            if (this[i] === what) return i;
Severity: Minor
Found in lib/assets/javascripts/functions.js - About 25 mins 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 PhotoCtrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function PhotoCtrl($scope, $resource, $routeParams, Photo) {

    var photoResource = Photo;
    var routeArgs = {photoId: $routeParams.photoId};
Severity: Minor
Found in app/assets/javascripts/angular/controllers/photos.js - About 25 mins 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

Method check_invalid_combinations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_invalid_combinations
    # any logged in user can be an owner? No
    if self.logged_in && self.owner? && self.user.blank?
      errors.add(:user_id, "Owner permissions must be specified with a user id.")
    end
Severity: Minor
Found in app/models/permission.rb - About 25 mins 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

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

    if user.is_fake_email &&
        canonical_data[:user].include?(:is_fake_email) && !canonical_data[:user][:is_fake_email] &&
        canonical_data[:user].include?(:email) && !canonical_data[:user][:email].blank?
      user.email = canonical_data[:user][:email]
      user.is_fake_email = false
Severity: Minor
Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 25 mins to fix
app/controllers/api/callbacks_controller.rb on lines 373..377

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

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

    if user.blank? &&
        canonical_data[:user].include?(:is_fake_email) && !canonical_data[:user][:is_fake_email] &&
        canonical_data[:user].include?(:email) && !canonical_data[:user][:email].blank?
      user = User.find_by_email(canonical_data[:user][:email])
    end
Severity: Minor
Found in app/controllers/api/callbacks_controller.rb and 1 other location - About 25 mins to fix
app/controllers/api/callbacks_controller.rb on lines 417..422

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

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 is_uuid
    unless self.audio_recording_uuid.blank?
      begin
        UUIDTools::UUID.parse(self.audio_recording_uuid)
      rescue
Severity: Minor
Found in app/models/saved_search/saved_search_store_body.rb and 1 other location - About 20 mins to fix
app/models/audio_recording.rb on lines 64..69

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

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 is_uuid
    unless self.uuid.blank?
      begin
        UUIDTools::UUID.parse(self.uuid)
      rescue
Severity: Minor
Found in app/models/audio_recording.rb and 1 other location - About 20 mins to fix
app/models/saved_search/saved_search_store_body.rb on lines 55..60

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

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

  def github_info(raw)
    {
        authorization:
            {
                provider: 'github',
Severity: Minor
Found in app/controllers/api/callbacks_controller.rb and 2 other locations - About 20 mins to fix
app/controllers/api/callbacks_controller.rb on lines 295..312
app/controllers/api/callbacks_controller.rb on lines 315..332

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

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