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

lint,cmd/kfulint: record types info and parsed ast files inside context #5

Closed
quasilyte opened this issue May 5, 2018 · 3 comments
Closed

Comments

@quasilyte
Copy link
Member

Currently, ast.ParseDir results are ignored.
It returns multiple packages, usually it's target package (same name as containing directory name) only,
but sometimes there is also testing package with _test suffix.

Proposed plan:

  1. Collect parsed packages.
  2. Iterate over these packages, init context with current package files and types info.
  3. Run checkers over that package with properly initialized context.
  4. Repeat until there are no packages left.

Note: we may reject multi-package folders for now.
In other words: it's OK to exit if len(packages) != 1 and that package name does not
match target package name. "proper" multi-package handling may be added later.
This can simplify initial implementation significantly.

lint.Context needs additional fields.
It definitely needs *types.Info and []*ast.File. Maybe something else.

@fexolm
Copy link
Contributor

fexolm commented May 5, 2018

Is it necessary for us to handle packages? Right now we don't have ( in plan ) any linters that would need any package information ( as far as i know ). So, maybe we would process every file independently? (Maybe not use parsedir at all, but use parsefile)
If it is possible ofc.

@quasilyte
Copy link
Member Author

Yes, we can ignore that detail and operate on file level.

@quasilyte
Copy link
Member Author

#7 solved that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants