anticycle / anticycle Goto Github PK
View Code? Open in Web Editor NEWTrack down import cycles in your GO project.
License: GNU General Public License v3.0
Track down import cycles in your GO project.
License: GNU General Public License v3.0
Describe the bug
In test we are using absolute paths everywhere but in real world anticycle will scan relative paths as well.
Right now path mismatch results as empty cycles list for packages witch in fact have cycles.
Godoc didn't fetch all docs. We need to add imports to doc.go so parser could fetch rest of the files.
In doc.go file few lines are rendered as source code. Need fix.
Is your feature request related to a problem? Please describe.
List of imports could be very long in some cases. Output should suggest line number of affected import.
Describe the solution you'd like
In text format:
[db -> models] "affected/import/package"
/path/to/file.go:12
In JSON format (only cycle fragmet):
{
"cycles": [
{
"affectedImport": {
"name": "testdata/notAffectedFiles/baz",
"nameShort": "baz",
"line": 12
},
"affectedFile": "testdata/notAffectedFiles/bar/bar.go"
}
]
}
Go clean removes object files and cached files.
Is your feature request related to a problem? Please describe.
Anticycle can be used as 3rd-party dependency. We should add mod.go feature.
Is your feature request related to a problem? Please describe.
Create .rpm package as part of CI release pipeline.
Is your feature request related to a problem? Please describe.
Remove duplicates from cycles map.
For example:
db -> models -> db
is the same as models -> db -> models
Describe the solution you'd like
Right now CLI always returns data but the goal of the tool is to return info about cycles, not all dependency graph. Output should be readable in form of a text report. New flag to specify different output format should be added like -format=json
.
Changes:
-version
flag-exclude
and -excludeOnly
should be change to take space-separated directoriesIs your feature request related to a problem? Please describe.
With big cycles and multiple files current text representation of cycles is not readable.
Describe the solution you'd like
General Map of package cyckle like foo -> bar -> baz -> foo
And then table with specific files, and imports which participate in cycle.
Additional context
Attached file.
cyckle-report.txt
Makefile is used only for development purposes. Make a better Makefile.
Inspiration: https://suva.sh/posts/well-documented-makefiles/
Is your feature request related to a problem? Please describe.
We need to write acceptance tests which cover all features in CLI with all possible combinations.
Describe the solution you'd like
It may be done in a way the sanity-tests are created.
Additional context
Unit tests don't cover using built and compressed binary file.
Is your feature request related to a problem? Please describe.
Proposal to add cycles map for every possible imports chain which leads to cycle.
In text format it could be printed at the beginning of the report, and in JSON format as separate metadata key.
Describe the solution you'd like
For JSON output:
{
"metadata": {
"cycles": [
["foo", "bar", "baz", "bar"],
["bar", "baz", "bar"],
["baz", "bar", "baz"]
]
},
"cycles": ["current report output here"]
}
In this structure, metadata
will hold all extra information, and cycles
will be output which is the same as current output.
For text output:
Found 3 cycles:
foo -> bar -> baz -> bar
bar -> baz -> bar
baz -> bar -> baz
[current report output here]
README.md is out of sync with sourcecode. Need update.
Describe the bug
When some package imports affected package automatically is mark as affected.
This is 100% correct but not helping at all.
Expected behavior
I'd like to see only these packages which are strictly involved in cycle.
All other packages which are incidentally affected should be removed from report.
Additional context
This log clearly show that cycle exists between db -> models -> db
packages.
But from ipam
you can get to models
from which you can get to db
and here cycle begins.
Packages: ipam
and services
should be removed from report because they create unnecessary information noise.
[db -> models] "github.com/Juniper/contrail/pkg/models"
pkg/db/address_manager.go
pkg/db/address_manager_test.go
pkg/db/db.go
pkg/db/db_test.go
pkg/db/useragent_kv.go
[models -> db] "github.com/Juniper/contrail/pkg/db"
pkg/models/validation.go
[services -> models] "github.com/Juniper/contrail/pkg/models"
pkg/services/contrail_service_test.go
pkg/services/event_test.go
pkg/services/list_response_test.go
[ipam -> models] "github.com/Juniper/contrail/pkg/models"
pkg/types/ipam/address_manager.go
Is your feature request related to a problem? Please describe.
All tests in CI and run locally should be call with -race flag even if there is no concurrency right now.
It may change in future and usage of gorutines may cause undetected bugs.
Describe the solution you'd like
Add -race
flag to all tests calls in makefile
Additional context
It is easy to forget about things you should remember of.
Is your feature request related to a problem? Please describe.
CI should be responsible for preparing compressed binaries and upload them to github release.
Describe the bug
https://circleci.com/gh/anticycle/anticycle/204
#!/bin/bash -eo pipefail
./build/tarball.sh /tmp/artifacts
/bin/bash: ./build/tarball.sh: No such file or directory
Exited with code 127
Is your feature request related to a problem? Please describe.
Right now test coverage is used separately and not in CI. It would be nice to have coverage print in test results like:
ok fmt 0.056s coverage: 91.7% of statements
Describe the solution you'd like
test: ## run tests
go test -race -covermode=count -coverprofile=none ./pkg/...
go test -race -covermode=count -coverprofile=none ./internal/...
Right now we are using gox to create binaries for different platforms.
We can do it without any 3rd-party tools. Cross compilation is built in Golang.
Since Anticycle started to use go.mod
it is not necessary to keep Gopkg.lock
and Gopkg.toml
files. Support for dep
should be dropped.
Describe the bug
Anticycle prints all files in package even if the don't participate in cycle. This creates clutter and is hard to read.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Anticycle should output only files affected with cycle not all files which belongs to affected package.
Letter "C" in front of import name is not readable enough with big output.
We need simple pipeline which runs unit tests only: Travis / CircleCI.
Investigation needed which open source tool suites our needs the most.
CircleCI supports insight statistics from tests.
Instructions https://circleci.com/blog/level-up-go-test-with-gotestsum
We need few sanity tests with most basic scenarios:
Describe the bug
hardware & software: macbook pro, macos mojave-10.14.5
process always got killed even though I just run "anticycle -version"
To Reproduce
Steps to reproduce the behavior:
process got killed
Expected behavior
should show version infomation
Environment (please complete the following information):
GOARCH="amd64"
GOBIN="/Users/yuanxie/work/go_proj/bin"
GOCACHE="/Users/yuanxie/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yuanxie/work/go_proj"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/yuanxie/work/forder-server/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kp/ymr5srdj4_s44jdjbmqqvxhh0000gn/T/go-build066343451=/tmp/go-build -gno-record-gcc-switches -fno-common"
Version v1.0.0, binary file
Bug in Make install recipe:
go install cmd/anticycle
can't load package: package cmd/anticycle: cannot find package "." in:
/usr/lib/go-1.10/src/cmd/anticycle
Is your feature request related to a problem? Please describe.
Create .deb package as part of CI release pipeline.
There are changes between v1.10 and v.1.11 which reflects in golden files.
All goldens and Circle CI container must be updated .
Is your feature request related to a problem? Please describe.
make deps
indicate that it is all about production dependencies, but in fact it only installs development dependencies. It may be confused.
Describe the solution you'd like
Change make deps
to make devdeps
Remove debugging features from release binaries and compress with UPX
There can be false positive match if external library have the same package name as project package.
For example:
Internal package types
and external package types
pkg/types
github.com/gogo/protobuf/types
Files:
pkg/common/common.go imports protobuf/types
pkg/types/types.go imports pkg/common
This will generate false positive because package short name overlaps with external library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.