-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from guard/update_project
Refactor and fix RubCop offenses
- Loading branch information
Showing
27 changed files
with
535 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
inherit_from: .rubocop_todo.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config` | ||
# on 2016-05-18 02:46:59 +0200 using RuboCop version 0.40.0. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the offenses are removed from the code base. | ||
# Note that changes in the inspected code, or installation of new | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 6 | ||
# Configuration parameters: CountComments. | ||
Metrics/ClassLength: | ||
Max: 485 | ||
|
||
# Offense count: 3 | ||
# Configuration parameters: CountComments. | ||
Metrics/MethodLength: | ||
Max: 18 | ||
|
||
# Offense count: 5 | ||
# Configuration parameters: CountComments. | ||
Metrics/ModuleLength: | ||
Max: 334 | ||
|
||
# Offense count: 10 | ||
Style/Documentation: | ||
Exclude: | ||
- 'spec/**/*' | ||
- 'test/**/*' | ||
- 'lib/notiffany.rb' | ||
- 'lib/notiffany/notifier.rb' | ||
- 'lib/notiffany/notifier/base.rb' | ||
- 'lib/notiffany/notifier/detected.rb' | ||
- 'lib/notiffany/notifier/tmux.rb' | ||
|
||
# Offense count: 52 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
# SupportedStyles: leading, trailing | ||
Style/DotPosition: | ||
Enabled: false | ||
|
||
# Offense count: 11 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
# SupportedStyles: symmetrical, new_line, same_line | ||
Style/MultilineMethodCallBraceLayout: | ||
Exclude: | ||
- 'spec/lib/notiffany/notifier/growl_spec.rb' | ||
- 'spec/lib/notiffany/notifier/libnotify_spec.rb' | ||
- 'spec/lib/notiffany/notifier/rb_notifu_spec.rb' | ||
- 'spec/lib/notiffany/notifier/terminal_notifier_spec.rb' | ||
- 'spec/lib/notiffany/notifier/tmux_spec.rb' | ||
|
||
# Offense count: 25 | ||
# Cop supports --auto-correct. | ||
Style/MutableConstant: | ||
Exclude: | ||
- 'lib/notiffany/notifier.rb' | ||
- 'lib/notiffany/notifier/base.rb' | ||
- 'lib/notiffany/notifier/detected.rb' | ||
- 'lib/notiffany/notifier/file.rb' | ||
- 'lib/notiffany/notifier/gntp.rb' | ||
- 'lib/notiffany/notifier/growl.rb' | ||
- 'lib/notiffany/notifier/libnotify.rb' | ||
- 'lib/notiffany/notifier/notifysend.rb' | ||
- 'lib/notiffany/notifier/rb_notifu.rb' | ||
- 'lib/notiffany/notifier/terminal_notifier.rb' | ||
- 'lib/notiffany/notifier/terminal_title.rb' | ||
- 'lib/notiffany/notifier/tmux.rb' | ||
- 'lib/notiffany/version.rb' | ||
- 'spec/lib/notiffany/notifier/base_spec.rb' | ||
|
||
# Offense count: 23 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
# SupportedStyles: only_raise, only_fail, semantic | ||
Style/SignalException: | ||
Exclude: | ||
- 'lib/notiffany/notifier.rb' | ||
- 'lib/notiffany/notifier/base.rb' | ||
- 'lib/notiffany/notifier/detected.rb' | ||
- 'lib/notiffany/notifier/file.rb' | ||
- 'lib/notiffany/notifier/growl.rb' | ||
- 'lib/notiffany/notifier/notifysend.rb' | ||
- 'lib/notiffany/notifier/terminal_notifier.rb' | ||
- 'lib/notiffany/notifier/tmux.rb' | ||
- 'spec/lib/notiffany/notifier/detected_spec.rb' | ||
|
||
# Offense count: 13 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
# SupportedStyles: use_perl_names, use_english_names | ||
Style/SpecialGlobalVars: | ||
Enabled: false | ||
|
||
# Offense count: 967 | ||
# Cop supports --auto-correct. | ||
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline. | ||
# SupportedStyles: single_quotes, double_quotes | ||
Style/StringLiterals: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
language: ruby | ||
bundler_args: --without development | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.1.5 | ||
- ruby-head | ||
- jruby | ||
- rbx-2 | ||
matrix: | ||
allow_failures: | ||
- rvm: rbx-2 | ||
- rvm: jruby | ||
- 2.2.5 | ||
- 2.3.1 | ||
- jruby-9.0.5.0 | ||
sudo: false | ||
cache: bundler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "logger" | ||
|
||
module Notiffany | ||
class Notifier | ||
# Configuration class for Notifier | ||
class Config | ||
DEFAULTS = { notify: true }.freeze | ||
|
||
attr_reader :env_namespace | ||
attr_reader :logger | ||
attr_reader :notifiers | ||
|
||
def initialize(opts) | ||
options = DEFAULTS.merge(opts) | ||
@env_namespace = opts.fetch(:namespace, "notiffany") | ||
@logger = _setup_logger(options) | ||
@notify = options[:notify] | ||
@notifiers = opts.fetch(:notifiers, {}) | ||
end | ||
|
||
def notify? | ||
@notify | ||
end | ||
|
||
private | ||
|
||
def _setup_logger(opts) | ||
opts.fetch(:logger) do | ||
Logger.new($stderr).tap { |l| l.level = Logger::WARN } | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.