Skip to content
Open
Show file tree
Hide file tree
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 Feb 26, 2020
5382a29
FIX PACKAGE REFERENCE TO UKINIMOD
ukinimod Feb 27, 2020
11a3f7e
ANALYSIS SKIPS FILES DIRS STARTING WITH . #5
ukinimod Feb 27, 2020
b9a1c33
ADD TESTS FOR FILETYPE
ukinimod Feb 27, 2020
159c4af
ADD SKIP_DIR ARGUMENT IN COMMAND
ukinimod Feb 28, 2020
e78027c
ADD ASSERT TO ANSIBLE MCC COUNT
ukinimod Feb 28, 2020
8f6d676
CONFIGURE GOLANGCI-LINT
ukinimod Mar 2, 2020
fa845c4
UPDATE DEPENDENCIES
ukinimod Mar 2, 2020
457c3d2
FIXES SOME LINTING FINDINGS
ukinimod Mar 2, 2020
949829f
Merge branch 'automatic_directory_and_file_ommision' into ansible_met…
ukinimod Mar 2, 2020
e29d3ea
CHANGE LOGGING FRAMEWORK TO LOGRUS
ukinimod Mar 2, 2020
6f82c62
IMPROVES CODE QUALITY USING CODE REVIEWW
ukinimod Mar 2, 2020
d33c825
temp
ukinimod Mar 3, 2020
4969694
STRIP TO YAML METRICS FOR REVIEW
ukinimod Mar 6, 2020
a046497
BEAUTIFY LICENSE.MD AND README.MD
ukinimod Mar 21, 2020
4869e58
EXCLUDE LINTING ISSUES AS INTENDED
ukinimod Mar 21, 2020
95cbb4e
IMPROVE READABILITY OF TESTS
ukinimod Mar 21, 2020
434bf58
RESTRICT LOC METRIC TO TEXT FILES
ukinimod Mar 21, 2020
0954e3e
FIX WRONG RLOC COUNTING
ukinimod Mar 21, 2020
195a32f
CHANGE MODEL
ukinimod Mar 25, 2020
4f6a91e
INTEGRATE CODE REVIEW SUGGESTIONS
ukinimod Mar 26, 2020
b8e5f4a
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
c10c6b1
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
37707ab
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
88f4ff8
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
36f6979
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
fceaf5c
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
b0dffce
Update pkg/metrics/commentlines.go
ukinimod Mar 27, 2020
7053efe
Update pkg/metrics/commentlinescalculator_test.go
ukinimod Mar 27, 2020
d98e87f
Update pkg/metrics/commentlinescalculator_test.go
ukinimod Mar 27, 2020
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
93 changes: 93 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
linters-settings:
Comment thread
ukinimod marked this conversation as resolved.
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
45 changes: 23 additions & 22 deletions LICENSE.md
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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Have a bug, a feature request or any question? Please [open a new issue](https:/
- [Releases](https://github.com/MaibornWolff/iac-count/releases)
- [Contributing](CONTRIBUTING.md)
- [Code of Conduct](CODE_OF_CONDUCT.md)
- [License](LICENSE.md)
- [License](LICENSE.md)
47 changes: 47 additions & 0 deletions cmd/root.go
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)
},
}
Binary file added doc/images/ansible_example_codecharta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/ansible_example_csv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/MaibornWolff/iac-count
Comment thread
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
)
Loading