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

Add a warning for unused contracts #1071

Open
rapenne-s opened this issue Jan 25, 2023 · 1 comment
Open

Add a warning for unused contracts #1071

rapenne-s opened this issue Jan 25, 2023 · 1 comment

Comments

@rapenne-s
Copy link

rapenne-s commented Jan 25, 2023

Is your feature request related to a problem? Please describe.

It happens that when writing a contract and using it in another file, if we forget to apply the contract or make a typo, nothing will tell us about it

Describe the solution you'd like

some command to make nickel verify all existing contracts in my file and from imported files are used, it should report a warning if a contract isn't used.

Additional context

A concrete example

contract.ncl

{
  MyData = 
  {
    foo | Str,
    attribute | Str | default = "world",
  }
}

data.ncl

let {MyData, ...} = import "contract.ncl" in
{
  data = 
  [
    { foo = "hello", attribute = "monde", },
    { foo = "world", },
  ],
}

This will work, I may think everything is fine, but the contract is just not used here, it's missing data | Array MyData in the example.

@yannham
Copy link
Member

yannham commented Jan 26, 2023

As a side note, there is not real notion of "contract" for the interpreter right now: contracts are just values like any other. I guess what we want is a warning for unused variables in general.

@jneem jneem mentioned this issue Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants