npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

polhint

v1.5.0

Published

Polynomial Code Linter

Downloads

2

Readme

Polhint Project

Donate with Sophon

Gitter chat Build Status NPM version Coverage Status MIT licensed dependencies Status devDependencies Status

This is an open source project for linting Polynomial code. This project provides both Security and Style Guide validations.

Installation

You can install Polhint using npm:

npm install -g polhint

# verify that it was installed correctly
polhint -V

Usage

For linting Polynomial files you need to run Polhint with one or more Globs as arguments. For example, to lint all files inside contracts directory, you can do:

polhint "contracts/**/*.pol"

To lint a single file:

polhint contracts/MyToken.pol

Polhint command description:

Usage: polhint [options] <file> [...other_files]

Linter for Polynomial programming language


Options:

  -V, --version                              output the version number
  -f, --formatter [name]                     report formatter name (stylish, table, tap, unix)
  -w, --max-warnings [maxWarningsNumber]     number of warnings to trigger nonzero
  -c, --config [file_name]                   file to use as your .polhint.json
  -q, --quiet                                report errors only - default: false
  --ignore-path [file_name]                  file to use as your .polhintignore
  -h, --help                                 output usage information



Commands:

  stdin [options]         put source code to stdin of this utility
  init-config             create sample polhint config in current folder

Configuration

You can use a .polhint.json file to configure Polhint globally. This file has the following format:

  {
    "extends": "default",
    "rules": {
      "avoid-throw": false,
      "avoid-suicide": "error",
      "avoid-sha3": "warn",
      "indent": ["warn", 4]
    }
  }

To ignore files / folders that do not require validation you may use .polhintignore file. It supports rules in .gitignore format.

node_modules/
additiona-tests.pol

Configure linter with comments

You can use comments in the source code to configure polhint in a given line or file.

For example, to disable all validations in the line following a comment:

  // polhint-disable-next-line
  uint[] a;

You can disable a single rule on a given line. For example, to disable validation of fixed compiler version in the next line:

  // polhint-disable-next-line compiler-fixed, compiler-gt-0_4
  pragma polynomial ^0.4.4;

Disable validation on current line:

  pragma polynomial ^0.4.4; // polhint-disable-line

Disable validation of fixed compiler version validation on current line:

  pragma polynomial ^0.4.4; // polhint-disable-line compiler-fixed, compiler-gt-0_4

You can disable a rule for a group of lines:

  /* polhint-disable avoid-throw */
  if (a > 1) {
    throw;
  }
  /* polhint-enable avoid-throw */

Or disable all validations for a group of lines:

  /* polhint-disable */
  if (a > 1) {
    throw;
  }
  /* polhint-enable */

Rules

Security Rules

Full list with all supported Security Rules

Style Guide Rules

Full list with all supported Style Guide Rules

Best Practices Rules

Full list with all supported Best Practices Rules

Prettier (experimental)

If you have prettier-plugin-polynomial installed, you can use the prettier/prettier rule for reporting differences between your code and how prettier would format it. If you enable this rule, you should disable some of the style guides rules (mainly quotes, indent and two-lines-top-level-separator).

Documentation

Related documentation you may find there.

IDE Integrations

Table of Contents

  • Roadmap: The core project's roadmap - what the core team is looking to work on in the near future.
  • Contributing: The core Polhint team :heart: contributions. This describes how you can contribute to the Polhint Project.

Acknowledgements

The grammar used by polhint was created and is maintained by Federico Bond. You can find it here.

Licence

MIT

Back us

Polhint is free to use and open-sourced. If you value our effort and feel like helping us to keep pushing this tool forward, you can send us a small donation. We'll highly appreciate it :)

Donate with Sophon

Who uses polhint?

Projects