harens / checkdigit Goto Github PK
View Code? Open in Web Editor NEW๐ An easy-to-use check digit library for data validation
Home Page: https://checkdigit.rtfd.io
License: GNU General Public License v3.0
๐ An easy-to-use check digit library for data validation
Home Page: https://checkdigit.rtfd.io
License: GNU General Public License v3.0
If the length of a GTIN code isn't 10, currently, checkdigit treats it as if it were 12 digits. This can lead to false results for other lengths.
This is the line in question:
Line 72 in a85a0a8
We always multiply by 6, which assumes the length is 12.
See here.
Currently, a separate README has to be used, since PyPi understandably doesn't like HTML in the rst file.
This means that the gif is currently broken, and a different file to the main README has to be maintained
Similar to seaport's tests.
This can hopefully not only speed up the tests, but also make it easier to see where they've failed.
The commands required are currently documented in the README. It would be useful to have it all in one script to make it easier to setup.
This would also help when more commands are added in the future. It could also be this file that is run by GitHub Actions.
The ISBN Functions can also be used for various other codes, including Bookland, EAN-13 and EAN-8.
It might be useful to refactor it such that there aren't different functions for different lengths (i.e. only one validation functions).
Also, find a generic name for these types of codes, and collect it all under one heading.
This was done with seaport, and so should be a similar process here.
This can allow us to automatically build the docs rather than updating it manually by hand with each new feature. This would however mean converting the markdown into rst.
The code is currently fully type-checked, so it shouldn't be that hard to get mypy tests passing. Some of the code might need to be reformatted for pylint to work properly.
This will improve the visual aspect of the README
See here
Currently, the short descriptions aren't very descriptive, e.g. ISBN Validation Functions.
Maybe it can be improved by saying what it actually is, similar to the wiki first line on the code.
Function calculate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
https://codeclimate.com/github/harens/checkdigit/checkdigit/luhn.py#issue_5fc23e4529cddf0001000020
EAN is calculated with the oppostie weightings to ISBN.
Maybe note that the info in the old wiki should no longer be viewed as correct?
bookUtils.cs -i isbnCalculate13 978-1-960957-03
Returns X --- instead of 0
bookUtils.cs -i isbnValidate13 978-1-960957-03-X --- Returns True
bookUtils.cs -i isbnValidate13 978-1-960957-03-0 --- Returns False
978-1-960957-03-0 is a valid ISBN13.
Returning X instead of 0 seems to be by design, but why?
If it is not by design, then it is a bug.
P.S. bookUtils.cs is just a python command service that uses checkdigit.isbn
There are many examples of python libraries that also feature CLI Tools (such as uvicorn)
There are various tools to accomplish this. However, the flags will have to be considered since there are lots of functions (validate10, missing, etc.)
Following from c6f2e58, the shell scripts were replaced with a Makefile.
It might be useful to somehow document the various attributes that it provides.
At the moment, there is very little error handling and defensive programming.
Small things such as detecting if there are invalid characters or whether the size is wrong (and then throwing an error) can help to improve the user experience.
This should be quite straight forward to do, and so this should be a good task for any new contributors!
See here.
All the GTIN-based codes should be a subset of GS1. The documentation should also be updated to reflect this.
Function missing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
https://codeclimate.com/github/harens/checkdigit/checkdigit/isbn.py#issue_5fc23e4529cddf000100001f
Use a Luhn Algorithm to check Credit Card and IMEI numbers
This is a planned feature
Showing example code in the README will help to show features
It will also help to improve understanding
Having more tests can never be a bad thing!
Tests can be found in the tests.py file. An example would be the following:
Line 64 in 59c3ee3
The first parameter of test
is the function to be tested, and the second is the expected value.
EDIT: This issue will be an ongoing issue, since when new features are added, more tests will be required.
See here
e.g. Company that issued the credit card.
A very pedantic and minor issue from me; v0.0.3 does not show as a release but merely as a tag.
All the best
EAN-13 and UPC-A, the two more common variants of each standard, are currently supported. It would be useful if EAN-8 and UPC-E, which are generally of a smaller size, are also supported.
See here for details about EAN/UPC barcodes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.