Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code for maintainabilty #206

Merged
merged 8 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Gemfile.lock
bin/bundle
bin/rspec
coverage/
modules/
tmp/
vendor/
Expand Down
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-10-08 19:19:01 UTC using RuboCop version 1.22.1.
# on 2021-10-18 14:18:47 UTC using RuboCop version 1.22.1.
# 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: 9
# Offense count: 8
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 60

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 131
Max: 134

# Offense count: 4
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 15

# Offense count: 16
# Offense count: 14
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 34
Expand Down
10 changes: 4 additions & 6 deletions features/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ Feature: CLI
Then the exit status should be 1

Scenario: When running the help command
When I run `msync help`
And the output should match /Commands:/
Then the exit status should be 0
When I successfully run `msync help`
ekohl marked this conversation as resolved.
Show resolved Hide resolved
Then the output should match /Commands:/

Scenario: When overriding a setting from the config file on the command line
Given a puppet module "puppet-test" from "fakenamespace"
Expand All @@ -35,9 +34,8 @@ Feature: CLI
"""
And a git_base option appended to "modulesync.yml" for local tests
And a directory named "moduleroot"
When I run `msync update --noop --namespace fakenamespace --branch command-line-branch`
Then the exit status should be 0
And the output should contain:
When I successfully run `msync update --verbose --noop --namespace fakenamespace --branch command-line-branch`
Then the output should contain:
"""
Creating new branch command-line-branch
"""
13 changes: 5 additions & 8 deletions features/hook.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ Feature: hook

Scenario: Activating a hook
Given a directory named ".git/hooks"
When I run `msync hook activate`
Then the exit status should be 0
And the file named ".git/hooks/pre-push" should contain "bash"
When I successfully run `msync hook activate`
Then the file named ".git/hooks/pre-push" should contain "bash"

Scenario: Deactivating a hook
Given a file named ".git/hooks/pre-push" with:
"""
git hook
"""
When I run `msync hook deactivate`
Then the exit status should be 0
When I successfully run `msync hook deactivate`
Then the file ".git/hooks/pre-push" should not exist

Scenario: Activating a hook with arguments
Given a directory named ".git/hooks"
When I run `msync hook activate -a '--foo bar --baz quux' -b master`
Then the exit status should be 0
And the file named ".git/hooks/pre-push" should contain:
When I successfully run `msync hook activate -a '--foo bar --baz quux' -b master`
Then the file named ".git/hooks/pre-push" should contain:
"""
"$message" -n puppetlabs -b master --foo bar --baz quux
"""
2 changes: 2 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@

# This enables coverage when aruba runs `msync` executable (cf. `bin/msync`)
set_environment_variable('COVERAGE', '1')

aruba.config.activate_announcer_on_command_failure = %i[stdout stderr]
end
Loading