kowainik / stan

🕵️ Haskell STatic ANalyser
https://kowainik.github.io/projects/stan
Mozilla Public License 2.0
565 stars 48 forks source link

Partial functions from boot libraries #89

Open vrom911 opened 4 years ago

vrom911 commented 4 years ago

containers

text

All functions as for lists, and much more. Also, for both Text types: strict Text and lazy Text.

bytestring

All functions as for lists, and much more. Also, for both ByteString types: strict ByteString and lazy ByteString.

chshersh commented 4 years ago

We can easily provide inspections for functions from the containers library, since there are not so many partial functions. But the number of partial functions in the API for text and bytestring is huge...

I had a thought about this issue: once #124 is implemented, inspections for those libraries (as well as any other library) can be simply defined as external TOML files with custom inspections. I imagine, we (or community, probably even text maintainers) can create a file like .stan-text.toml with custom inspections for text like:

[[inspection]]
type = "FindName"
id   = "TEXT-0001"
name = "Usage of partial function: Data.Text.head"
...

[[inspection]]
type = "FindName"
id   = "TEXT-0002"
name = "Usage of partial function: Data.Text.tail"
...

And during Stan work, users can simply specify paths/urls to those files and get all those inspections for their projects.