-
Notifications
You must be signed in to change notification settings - Fork 0
Yaml metrics #7
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
Open
ukinimod
wants to merge
30
commits into
master
Choose a base branch
from
yaml_metrics
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Yaml metrics #7
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
de23810
CREATE ANALYZER FOR ANSIBLE METRICS
ukinimod 5382a29
FIX PACKAGE REFERENCE TO UKINIMOD
ukinimod 11a3f7e
ANALYSIS SKIPS FILES DIRS STARTING WITH . #5
ukinimod b9a1c33
ADD TESTS FOR FILETYPE
ukinimod 159c4af
ADD SKIP_DIR ARGUMENT IN COMMAND
ukinimod e78027c
ADD ASSERT TO ANSIBLE MCC COUNT
ukinimod 8f6d676
CONFIGURE GOLANGCI-LINT
ukinimod fa845c4
UPDATE DEPENDENCIES
ukinimod 457c3d2
FIXES SOME LINTING FINDINGS
ukinimod 949829f
Merge branch 'automatic_directory_and_file_ommision' into ansible_met…
ukinimod e29d3ea
CHANGE LOGGING FRAMEWORK TO LOGRUS
ukinimod 6f82c62
IMPROVES CODE QUALITY USING CODE REVIEWW
ukinimod d33c825
temp
ukinimod 4969694
STRIP TO YAML METRICS FOR REVIEW
ukinimod a046497
BEAUTIFY LICENSE.MD AND README.MD
ukinimod 4869e58
EXCLUDE LINTING ISSUES AS INTENDED
ukinimod 95cbb4e
IMPROVE READABILITY OF TESTS
ukinimod 434bf58
RESTRICT LOC METRIC TO TEXT FILES
ukinimod 0954e3e
FIX WRONG RLOC COUNTING
ukinimod 195a32f
CHANGE MODEL
ukinimod 4f6a91e
INTEGRATE CODE REVIEW SUGGESTIONS
ukinimod b8e5f4a
Update pkg/metrics/commentlines.go
ukinimod c10c6b1
Update pkg/metrics/commentlines.go
ukinimod 37707ab
Update pkg/metrics/commentlines.go
ukinimod 88f4ff8
Update pkg/metrics/commentlines.go
ukinimod 36f6979
Update pkg/metrics/commentlines.go
ukinimod fceaf5c
Update pkg/metrics/commentlines.go
ukinimod b0dffce
Update pkg/metrics/commentlines.go
ukinimod 7053efe
Update pkg/metrics/commentlinescalculator_test.go
ukinimod d98e87f
Update pkg/metrics/commentlinescalculator_test.go
ukinimod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,93 @@ | ||
| --- | ||
| linters-settings: | ||
| dupl: | ||
| threshold: 100 | ||
| funlen: | ||
| lines: 100 | ||
| statements: 50 | ||
| goconst: | ||
| min-len: 5 | ||
| min-occurrences: 5 | ||
| gocritic: | ||
| enabled-tags: | ||
| - diagnostic | ||
| - experimental | ||
| - opinionated | ||
| - performance | ||
| - style | ||
| disabled-checks: | ||
| - dupImport | ||
| - ifElseChain | ||
| - octalLiteral | ||
| - whyNoLint | ||
| - wrapperFunc | ||
| gocyclo: | ||
| min-complexity: 15 | ||
| goimports: | ||
| local-prefixes: github.com/golangci/golangci-lint | ||
| golint: | ||
| min-confidence: 0 | ||
| govet: | ||
| check-shadowing: true | ||
| settings: | ||
| printf: | ||
| funcs: | ||
| - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
| - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
| - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
| - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
| lll: | ||
| line-length: 140 | ||
| maligned: | ||
| suggest-new: true | ||
| misspell: | ||
| locale: US | ||
|
|
||
| linters: | ||
| disable-all: true | ||
| enable: | ||
| - bodyclose | ||
| - deadcode | ||
| - depguard | ||
| - dogsled | ||
| - errcheck | ||
| - funlen | ||
| - goconst | ||
| - gocritic | ||
| - gocyclo | ||
| - gofmt | ||
| - goimports | ||
| - golint | ||
| - goprintffuncname | ||
| - gosec | ||
| - gosimple | ||
| - govet | ||
| - ineffassign | ||
| - interfacer | ||
| - lll | ||
| - misspell | ||
| - nakedret | ||
| - rowserrcheck | ||
| - scopelint | ||
| - staticcheck | ||
| - structcheck | ||
| - stylecheck | ||
| - typecheck | ||
| - unconvert | ||
| - unparam | ||
| - unused | ||
| - varcheck | ||
| - whitespace | ||
|
|
||
| # don't enable: | ||
| # - dupl | ||
| # - gochecknoglobals | ||
| # - gochecknoinits | ||
| # - gocognit | ||
| # - godox | ||
| # - gomnd | ||
| # - maligned | ||
| # - prealloc | ||
|
|
||
| service: | ||
| golangci-lint-version: 1.23.x | ||
This file contains hidden or 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,26 +1,27 @@ | ||
| Copyright (c) 2020, MaibornWolff GmbH | ||
| All rights reserved. | ||
| # BSD 3-Clause License | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
| Copyright (c) 2020, MaibornWolff GmbH. All rights reserved. | ||
|
|
||
| * Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution. | ||
| * Neither the name of nor the names of its contributors may be used to | ||
| endorse or promote products derived from this software without specific | ||
| prior written permission. | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 1. Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
| 2. Redistributions in binary form must reproduce the above copyright | ||
| notice, this list of conditions and the following disclaimer in the | ||
| documentation and/or other materials provided with the distribution. | ||
| 3. Neither the name of nor the names of its contributors may be used to | ||
| endorse or promote products derived from this software without specific | ||
| prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or 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 hidden or 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,47 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "os" | ||
|
|
||
| "github.com/MaibornWolff/iac-count/pkg/core" | ||
| "github.com/MaibornWolff/iac-count/pkg/output" | ||
| log "github.com/sirupsen/logrus" | ||
|
|
||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| var Debug bool | ||
| var Quiet bool | ||
| var PrintLevel string | ||
|
|
||
| func init() { | ||
| RootCmd.PersistentFlags().BoolVarP(&Debug, "debug", "d", false, "debug level logging") | ||
| RootCmd.PersistentFlags().BoolVarP(&Quiet, "quiet", "q", false, "error level logging only") | ||
|
|
||
| RootCmd.PersistentFlags().StringVar(&PrintLevel, "level", "file", "print level (file|role|project)") | ||
| } | ||
|
|
||
| func configureLogging() { | ||
| if Debug { | ||
| log.SetLevel(log.DebugLevel) | ||
| } else if Quiet { | ||
| log.SetLevel(log.ErrorLevel) | ||
| } else { | ||
| log.SetLevel(log.WarnLevel) | ||
| } | ||
|
|
||
| log.SetOutput(os.Stderr) | ||
| } | ||
|
|
||
| var RootCmd = &cobra.Command{ | ||
| Use: "ANSIBLE_ROOT", | ||
| Short: "analyzes projects", | ||
| Long: "analyzes projects", | ||
| Args: cobra.ExactArgs(1), | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| configureLogging() | ||
|
|
||
| fileMetrics := core.DirectoryCreator{}.CreateFromPath(args[0], nil).Analyze() | ||
| output.PrintMetricsAsCsv(fileMetrics, PrintLevel) | ||
| }, | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,13 @@ | ||
| module github.com/MaibornWolff/iac-count | ||
|
bastiandg marked this conversation as resolved.
|
||
|
|
||
| go 1.13 | ||
|
|
||
| require ( | ||
| github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect | ||
| github.com/sirupsen/logrus v1.4.2 | ||
| github.com/spf13/cobra v0.0.6 | ||
| github.com/spf13/pflag v1.0.5 // indirect | ||
| github.com/stretchr/testify v1.2.2 | ||
| golang.org/x/sys v0.0.0-20200302083256-062a44052db1 // indirect | ||
| gopkg.in/yaml.v2 v2.2.8 | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.