expertiza/expertiza

View on GitHub
app/models/google_doc_fetcher.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
90%

Method has too many lines. [14/10]
Open

  def fetch_content
    file_id = get_id_from_url(@url)
    if file_id.length >= 0
      req_url = "https://www.googleapis.com/drive/v3/files/#{file_id}" \
                + '/export?' + 'mimeType=text/plain' \
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Redundant return detected.
Open

      return false
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Don't use parentheses around the condition of an if.
Open

        if (HttpRequest.valid_url?(url) && lower_case_url.include?(allowed_host))
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Missing top-level class documentation comment.
Open

class GoogleDocFetcher
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

      allowed_hosts = ["drive.google.com", "docs.google.com"]
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

      allowed_hosts = ["drive.google.com", "docs.google.com"]
Severity: Minor
Found in app/models/google_doc_fetcher.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

There are no issues that match your filters.

Category
Status