sapristi-tool/sapristi

View on GitHub

Showing 114 of 114 total issues

Line is too long. [115/80]
Open

        raise "#{key}=#{raw}, using percentage in invalid field, valid=#{Definition::TRANSLATIONS.keys.join(', ')}"

Use tr instead of gsub.
Open

        name = key.downcase.gsub(/-/, '_')
Severity: Minor
Found in lib/sapristi/definition.rb by rubocop

This cop identifies places where gsub can be replaced by tr or delete.

Example:

# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')

# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')

Use Range#cover? instead of Range#include?.
Open

      return if (0...monitor_height).include? y_pos
Severity: Minor
Found in lib/sapristi/definition_parser.rb by rubocop

This cop identifies uses of Range#include?, which iterates over each item in a Range to see if a specified item is there. In contrast, Range#cover? simply compares the target item with the beginning and end points of the Range. In a great majority of cases, this is what is wanted.

Here is an example of a case where Range#cover? may not provide the desired result:

('a'..'z').cover?('yellow') # => true

Line is too long. [91/80]
Open

        raise Error, "Invalid configuration file: #{e.message}, line=#{line}, file=#{file}"

Line is too long. [87/80]
Open

          Process.spawn(cmd, out: [out, 'a'], err: [err, 'a'], pgroup: Process.getpgrp)

Line is too long. [101/80]
Open

        new_window = detect_new_windows.find { |window| window_for?(waiter, program, title, window) }

Line is too long. [111/80]
Open

      raise Error, "Trying to write empty configuration on existing file #{conf_file}" if File.exist? conf_file

Line is too long. [112/80]
Open

    def initialize(configuration_loader: ConfigurationLoader.new, definition_processor: DefinitionProcessor.new)
Severity: Minor
Found in lib/sapristi/sapristi.rb by rubocop

Line is too long. [119/80]
Open

      opts.on('-w', '--wait-time NUMBER_OF_SECONDS (1-120), default=30', 'Wait time for detecting a window') do |value|
Severity: Minor
Found in lib/sapristi/arguments_parser.rb by rubocop

Line is too long. [116/80]
Open

      log.debug "Found new window: pid=#{window.pid}, ppid=#{window_pgroup}, id=#{window.id}, title=#{window.title}"

Line is too long. [120/80]
Open

      raise Error, "#{key} percentage is invalid=#{raw}, valid=5%-100%" if percentage < min_percentage || percentage > 1

TODO found
Open

    # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
Severity: Minor
Found in sapristi.gemspec by fixme

TODO found
Open

  # spec.description   = %q{TODO: Write a longer description or delete this line.}
Severity: Minor
Found in sapristi.gemspec by fixme

TODO found
Open

    # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
Severity: Minor
Found in sapristi.gemspec by fixme
Severity
Category
Status
Source
Language