GithubHelp home page GithubHelp logo

importas's Issues

Can't use non capturing group in the alias

It seems that the library uses the : token to parse the input causing it to wrongly parse regexes with non capturing groups.

Example:

-alias k8s.io/apimachinery/pkg/(?:api/)?(\w+):k8$1

Error:

importas: error parsing regexp: invalid or unsupported Perl syntax: (?$``

Releasing package with tags

@julz is it possible to use semver based tagging (add tags after adding features or fixing bugs), it can make the life of the maintainers of tools that depend on importas way easier (speaking about myself who is trying to keep tooling updated as much as possible in golangci-lint).

Also, @dependabot can easily track dependencies, which is also a nice thing to have.

Restricting CAPS in import aliases

I'd like to check if import alias has no CAPS in its name. I wasn't able to find any linter that can do that. Do you think importas can be the one who can provide this functionality? I can contribute if you agree.

Rule Order

Would it be possible to get the order of the rules respected internally? With the rules being put into a map, the order is different from run to run. When utilizing the regexp rules, it would be helpful to be able to rely on the order so you can get progressively broader in the rules.

Using importas within golangci-lint w/ both no-unaliased and no-extra-aliases fails

Looking to leverage both no-unaliased and no-extra-aliased flags in golangci-lint, and end up getting results where un-aliased imports start giving problematic results. Ideally we'd have the restrictions provided by both the flags (consistent, always-defined aliases; rejecting any new aliases that aren't described)

linters-settings:
  importas:
    no-unaliased: true
    no-extra-aliases: true
    alias:
...

Which results in a number of issues, where even standard libraries act as if they have an alias but not in the config:

import "time" has alias "" which is not part of config (importas)
        "time"

checking different aliases for the same package

Problem:

Importas uses rules to standardize package aliases. But as the project gets bigger, there will be more and more rules and it is difficult to maintain. There may be cases where the same package has different aliases because this package is not covered by the rules. Importas cannot handle this situation because it does not support checking whether there are different aliases for the same package in different go files or in same go file without rules.

solution you'd like.

Checking whether there are different aliases for the same package before checking the aliases according to the importas rules.
Like this :

144870293-cd6b29dd-4be0-4be6-b26c-ed62983921dc
144870344-a8bae3a3-d739-4743-b188-8db0dfb8b4d7

This little implement, https://github.com/Rodge0/samealias, maybe useful.

Appreciate!

feature request: -no-extra-aliases

Feature request: add a new flag -no-extra-aliases or -allow-list which only permits aliases passed to importas.
This would effectively make importas aliases an allow list for all aliases in the scanned packages.

Projects which use this setting would force developers to add importas aliases to their lint config settings if they would like to alias a package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.