Package: chcss
A CSS naming hierarchy enforcer.What is chcss?chcssis a PyParsing based grammar for parsing and verifying that
CSS class names are used in the correct hierarchy in HTML files.chcssparses HTML files into a DOM model, and then walks the tree
checking class identifiers to ensure they are arranged hierarchically.The basic grammar is:namespace-function((-component)+(-element(-modifier)*)?)?So long as identifiers are correctly nested, the program returns with
exit status 0.  If errors are detected, the program returns with exit
status 1 and a hopefully helpful error message as to which identifier
on which element caused the first violation, with the goal being easy
integration into a gitcommit-msghook orpre-commit.RoadmapImplement testing, build, documentation, and CI.Implementclassidentifier parser.Implement parser field definitions in configuration file.Implement ignorableclassidentifiers in configuration file
(i.e. Bootstrap).Implement HTML DOM parser (from library).Produceclassidentifiers from HTML DOM.Verifyclassidentifier hierarchy.Use information from HTML DOM andclassidentifier parser to raise
exceptions and provide useful error messages.Implement hierarchicalididentifier parsing (maybe; target: post 1.0.0).InstallationInstall chcss with:pip install chcss
pip freeze > requirements.txtor add as a poetry dev-dependency.If you desire a package locally built with poetry, download the
source, change the appropriate lines inpyproject.toml, and
rebuild.To use as a gitcommit-msghook, copy the scriptchcssto.git/hooks/commit-msgand set the file as executable or integrate
the script or module into your existingcommit-msghook.  Runningchcssas a hook relies ongitsetting the current working
directory of the script to the root of the repository (wherepyproject.tomlorpackage.jsontypically lives).  If this is
not the repository default, pass the configuration file path as an
argument or symlink from the current working directory to an
appropriate configuration file.  Optimally, runchcssfrompre-committo check HTML files as necessary.UsageConsole:chcss file.html
cat file.html | chcssIn Python:>>> import chcssSee the source anddocumentationfor more information.ConfigurationSeechcss.tomlfor an example[tool.chcss]section that may be
copied into apyproject.tomlfile.  The same entries may be used
in achcssentry inpackage.jsonfor JavaScript/TypeScript
projects.Parsing GrammarBasic Specification:namespace-function((-component)+(-element(-modifier)*)?)?Copyright and LicenseSPDX-License-Identifier:GPL-3.0-or-laterchcss, a CSS naming hierarchy enforcer.
Copyright (C) 2021Jeremy A Gray.This program is free software: you can redistribute it and/or modify
it under the terms of theGNU General Public Licenseas published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.You should have received a copy of theGNU General Public Licensealong with this program.
If not, seehttps://www.gnu.org/licenses/.AuthorJeremy A Gray