diff options
author | B. Watson <urchlay@slackware.uk> | 2023-01-20 05:43:29 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-01-21 10:22:06 +0700 |
commit | be2d703e5ca7dc496df0a86d3c5855c843085ffb (patch) | |
tree | b1388c8eb0f5d63341592d87aa5b3a8c95162344 /development | |
parent | 71bffab76c76cda042bae8be14f7bdd7dd9108a7 (diff) |
development/kodespel: Added (spell-checker for source code)
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development')
-rw-r--r-- | development/kodespel/README | 8 | ||||
-rw-r--r-- | development/kodespel/git2tarxz.sh | 65 | ||||
-rw-r--r-- | development/kodespel/kodespel.1 | 257 | ||||
-rw-r--r-- | development/kodespel/kodespel.SlackBuild | 85 | ||||
-rw-r--r-- | development/kodespel/kodespel.info | 10 | ||||
-rw-r--r-- | development/kodespel/kodespel.rst | 180 | ||||
-rw-r--r-- | development/kodespel/sbo.dict | 19 | ||||
-rw-r--r-- | development/kodespel/slack-desc | 19 |
8 files changed, 643 insertions, 0 deletions
diff --git a/development/kodespel/README b/development/kodespel/README new file mode 100644 index 0000000000000..6d6fcf6724080 --- /dev/null +++ b/development/kodespel/README @@ -0,0 +1,8 @@ +kodespel (spell-checker for source code) + +kodespel is a spellchecker for source code. kodespel's nifty trick +is that it knows how to split common programming identifiers like +'getAllStuff' or 'DoThingsNow' or 'num_objects' or 'HTTPResponse' into +words, feed those to ispell, and interpret ispell's output. + +See also: codespell (same concept, different implementation). diff --git a/development/kodespel/git2tarxz.sh b/development/kodespel/git2tarxz.sh new file mode 100644 index 0000000000000..c7169b5e27f82 --- /dev/null +++ b/development/kodespel/git2tarxz.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +# Create source tarball from git repo, with generated version number. + +# Takes one optional argument, which is the commit or tag to create a +# tarball of. With no arg, HEAD is used. + +# Version number example: 0.0.1+20200227_ad7ec17 + +# Notes: + +# Do not use this if you're packaging a release. + +# This script doesn't need to be run as root. It does need to be able +# to write to the current directory it's run from. + +# Running this script twice for the same commit will NOT give identical +# tarballs, even if the contents are identical. This is because tar +# includes the current time in a newly-created tarball (plus there may +# be other git-related reasons). + +# Once you've generated a tarball, you'll still need a place to host it. +# Ask on the mailing list, if you don't have your own web server to +# play with. + +## Config: + +PRGNAM=kodespel +CLONE_URL=https://github.com/gward/kodespel + +## End of config. + +set -e + +GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX ) +rm -rf $GITDIR +git clone $CLONE_URL $GITDIR + +CWD="$( pwd )" +cd $GITDIR + +if [ "$1" != "" ]; then + git reset --hard "$1" || exit 1 +fi + +GIT_SHA=$( git rev-parse --short HEAD ) + +DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 ) + +VERTAG=$( git tag -l | tail -1 ) + +VERSION=${VERTAG}+${DATE}_${GIT_SHA} + +rm -rf .git +find . -name .gitignore -print0 | xargs -0 rm -f + +cd "$CWD" +rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz +mv $GITDIR $PRGNAM-$VERSION +tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION + +echo +echo "Created tarball: $PRGNAM-$VERSION.tar.xz" +echo "VERSION=\"$VERSION\"" +echo "MD5SUM=\"$( md5sum $PRGNAM-$VERSION.tar.xz | cut -d' ' -f1 )\"" diff --git a/development/kodespel/kodespel.1 b/development/kodespel/kodespel.1 new file mode 100644 index 0000000000000..6f58b9cde32d8 --- /dev/null +++ b/development/kodespel/kodespel.1 @@ -0,0 +1,257 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "KODESPEL" 1 "2023-01-16" "0.1.1+20220227_e0095c7" "SlackBuilds.org" +.SH NAME +kodespel \- spell-checker for source code +.\" RST source for kodespel(1) man page. Convert with: +. +.\" rst2man.py kodespel.rst > kodespel.1 +. +.SH SYNOPSIS +.sp +kodespel [\fB\-d\fP \fIdictionary\fP] \fIfile\fP [\fIfile\fP ...] +.sp +kodespel \fB\-\-list\-dicts\fP +.SH DESCRIPTION +.sp +kodespel is a spellchecker for source code. kodespel\(aqs nifty trick +is that it knows how to split common programming identifiers like +\(aqgetAllStuff\(aq or \(aqDoThingsNow\(aq or \(aqnum_objects\(aq or \(aqHTTPResponse\(aq into +words, feed those to \fBispell\fP(1), and interpret ispell\(aqs output. +.sp +Basic usage is to run kodespel on one or more individual files +or directories: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel foo.py main.go README.md +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +kodespel uses a collection of dictionaries to spellcheck each file. +It always uses the \fBbase\fP dictionary, which is a set of words +common in source code across languages and platforms. Additionally, +there is a language\-specific dictionary for each language kodespel +knows about. Language\-specific dictionaries are automatically chosen +for you. +.sp +In this example, kodespell will spellcheck each file with: +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.IP \(bu 2 +\fBfoo.py\fP: dictionaries \fBbase\fP and \fBpython\fP +.IP \(bu 2 +\fBmain.go\fP: dictionaries \fBbase\fP and \fBgo\fP +.IP \(bu 2 +\fBREADME.md\fP: dictionary \fBbase\fP only (no language dictionary for Markdown) +.UNINDENT +.UNINDENT +.UNINDENT +.sp +If run on a directory, kodespel will recurse into that directory +and spellcheck every file that it recognizes: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel src/ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +will search for \fB*.py\fP, \fB*.c\fP, \fB*.h\fP, and any other +extension that kodespel has built\-in support for. +(Currently: Python, Perl, Go, C, C++, and Java). +Unsupported files are ignored, but if you pass those filenames +explicitly, they will be checked. +.INDENT 0.0 +.INDENT 3.5 +Note: the SlackBuilds.org package of \fBkodespel\fP includes a +\fBsbo\fP dictionary. It will only be used if you enable it +with \fB\-d sbo\fP\&. +.UNINDENT +.UNINDENT +.sp +kodespel ships with several other common dictionaries. +For example, if the program you are spellchecking uses +a lot of Unix system calls, you would add the \fBunix\fP dictionary: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel \-d unix foo.py main.go README.md +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The \fB\-d\fP option applies to every file being checked. +.sp +To see the list of all builtin dictionaries, run: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel \-\-list\-dicts +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Finally, you can create your own dictionaries, +and use as many of them as you like. +A dictionary is a plain text file with one word per line: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat myproject.dict +nargs +args +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can specify your personal dictionaries with \fB\-d\fP, +just like kodespel\(aqs builtin dictionaries: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel \-d unix \-d myproject.dict foo.py ... +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-h\fP,\fB \-\-help +Show built\-in help and exit. +.TP +.B \-a\fP,\fB \-\-all +Report every single misspelling [default: \fB\-\-unique\fP]. +.TP +.B \-u\fP,\fB \-\-unique +Report each misspelling only once [default]. +.TP +.BI \-d \ dict\fR,\fB \ \-\-dictionary\fB= dict +Use this dictionary. \fIdict\fP may be a filename or a dictionary name. Use +multiple times to include multiple dictionaries. +.TP +.B \-\-list\-dicts +List available dictionaries and exit. +.TP +.B \-\-dump\-dict +Build custom dictionary (respecting \fB\-d\fP options). +.TP +.BI \-\-make\-dict\fB= dictfile +Write unknown words to \fIdictfile\fP\&. +.TP +.BI \-i \ string\fR,\fB \ \-\-ignore\fB= regex +Ignore any words matching \fIregex\fP\&. +.TP +.B \-C\fP,\fB \-\-compound +Allow compound words (e.g. \fBgetall\fP) [default]. +.TP +.B \-\-no\-compound +Do not allow compound words +.TP +.BI \-W \ N\fR,\fB \ \-\-wordlen\fB= N +Ignore words with <= \fIN\fP characters [default: 3]. +.UNINDENT +.SH EXIT STATUS +.INDENT 0.0 +.IP \(bu 2 +\fB0\fP \- success; no misspellings found. +.IP \(bu 2 +\fB1\fP \- at least one misspelling found \fIor\fP there was an error reading +one or more input file (including encoding errors for non\-UTF8 files). +.IP \(bu 2 +\fB2\fP \- invalid command line option(s). +.UNINDENT +.SH FILES +.INDENT 0.0 +.TP +.B \fB/usr/share/kodespel/\fP +The default dictionaries are stored here. +.UNINDENT +.SH LIMITATIONS +.sp +\fBkodespel\fP has no option to read from standard input. However, on Linux, +you can run \fBkodespel\fP \fB/dev/stdin\fP\&. +.sp +\fBkodespel\fP can only handle \fBUTF\-8\fP encoding (which includes 7\-bit \fBASCII\fP). +It will choke on files that use e.g. \fBISO\-8859\fP encoding. +.sp +\fBkodespel\fP writes its output to \fBstderr\fP, not \fBstdout\fP\&. This makes +it difficult to use it from a script. Try e.g: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +kodespel <args> 2>&1 | <command> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Also, if you get exit status 1, you can\(aqt tell if that\(aqs an actual error +or misspellings were found, without examining the actual output. +.SH COPYRIGHT +.sp +See the file /usr/doc/kodespel\-0.1.1+20220227_e0095c7/LICENSE.txt for license information. +.SH AUTHORS +.sp +kodespel was written by Greg Ward. +.sp +This man page written (mostly copied and adapted from README.md and +the \-\-help output) for the SlackBuilds.org project by B. Watson, and +is licensed under the WTFPL. +.SH SEE ALSO +.sp +The kodespel homepage: \fI\%https://pypi.org/project/kodespel/\fP +.sp +\fBcodespell\fP(1) +.\" Generated by docutils manpage writer. +. diff --git a/development/kodespel/kodespel.SlackBuild b/development/kodespel/kodespel.SlackBuild new file mode 100644 index 0000000000000..322ec37c2b7e6 --- /dev/null +++ b/development/kodespel/kodespel.SlackBuild @@ -0,0 +1,85 @@ +#!/bin/bash + +# Slackware build script for kodespel + +# Written by B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# I'm using a git snapshot rather than the 0.1.1 release because the +# release has 2 fairly major issues: +# - It can't read from standard input even with /dev/stdin as a filename. +# - Its error handling is broken in some cases (e.g. -d with a nonexistent +# dictionary/file) and prints a python stack trace rather than a meaningful +# error message. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=kodespel +VERSION=${VERSION:-0.1.1+20220227_e0095c7} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.xz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +python3 setup.py install --root=$PKG + +# man page by SlackBuild author (adapted from README.md and --help). +mkdir -p $PKG/usr/man/man1 +gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz + +# bonus dictionary for SlackBuilds (nowhere near complete though). +cat $CWD/sbo.dict > $PKG/usr/share/$PRGNAM/sbo.dict + +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKGDOC +cp -a LICENSE* README* $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/development/kodespel/kodespel.info b/development/kodespel/kodespel.info new file mode 100644 index 0000000000000..1e00da9b2f521 --- /dev/null +++ b/development/kodespel/kodespel.info @@ -0,0 +1,10 @@ +PRGNAM="kodespel" +VERSION="0.1.1+20220227_e0095c7" +HOMEPAGE="https://pypi.org/project/kodespel/" +DOWNLOAD="https://slackware.uk/~urchlay/src/kodespel-0.1.1+20220227_e0095c7.tar.xz" +MD5SUM="59e11ff81b65da2834cee44567bc80f1" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/development/kodespel/kodespel.rst b/development/kodespel/kodespel.rst new file mode 100644 index 0000000000000..02483ad2cd2d8 --- /dev/null +++ b/development/kodespel/kodespel.rst @@ -0,0 +1,180 @@ +.. RST source for kodespel(1) man page. Convert with: +.. rst2man.py kodespel.rst > kodespel.1 + +.. |version| replace:: 0.1.1+20220227_e0095c7 +.. |date| date:: + +======== +kodespel +======== + +----------------------------- +spell-checker for source code +----------------------------- + +:Manual section: 1 +:Manual group: SlackBuilds.org +:Date: |date| +:Version: |version| + +SYNOPSIS +======== + +kodespel [**-d** *dictionary*] *file* [*file* ...] + +kodespel **--list-dicts** + +DESCRIPTION +=========== + +kodespel is a spellchecker for source code. kodespel's nifty trick +is that it knows how to split common programming identifiers like +'getAllStuff' or 'DoThingsNow' or 'num_objects' or 'HTTPResponse' into +words, feed those to **ispell**\(1), and interpret ispell's output. + +Basic usage is to run kodespel on one or more individual files +or directories:: + + kodespel foo.py main.go README.md + +kodespel uses a collection of dictionaries to spellcheck each file. +It always uses the **base** dictionary, which is a set of words +common in source code across languages and platforms. Additionally, +there is a language-specific dictionary for each language kodespel +knows about. Language-specific dictionaries are automatically chosen +for you. + +In this example, kodespell will spellcheck each file with: + + * **foo.py**: dictionaries **base** and **python** + * **main.go**: dictionaries **base** and **go** + * **README.md**: dictionary **base** only (no language dictionary for Markdown) + +If run on a directory, kodespel will recurse into that directory +and spellcheck every file that it recognizes:: + + kodespel src/ + +will search for **\*.py**, **\*.c**, **\*.h**, and any other +extension that kodespel has built-in support for. +(Currently: Python, Perl, Go, C, C++, and Java). +Unsupported files are ignored, but if you pass those filenames +explicitly, they will be checked. + + Note: the SlackBuilds.org package of **kodespel** includes a + **sbo** dictionary. It will only be used if you enable it + with **-d sbo**. + +kodespel ships with several other common dictionaries. +For example, if the program you are spellchecking uses +a lot of Unix system calls, you would add the **unix** dictionary:: + + kodespel -d unix foo.py main.go README.md + +The **-d** option applies to every file being checked. + +To see the list of all builtin dictionaries, run:: + + kodespel --list-dicts + +Finally, you can create your own dictionaries, +and use as many of them as you like. +A dictionary is a plain text file with one word per line:: + + $ cat myproject.dict + nargs + args + +You can specify your personal dictionaries with **-d**, +just like kodespel's builtin dictionaries:: + + kodespel -d unix -d myproject.dict foo.py ... + +OPTIONS +======= + +-h, --help + Show built-in help and exit. + +-a, --all + Report every single misspelling [default: **--unique**]. + +-u, --unique + Report each misspelling only once [default]. + +-d dict, --dictionary=dict + Use this dictionary. *dict* may be a filename or a dictionary name. Use + multiple times to include multiple dictionaries. + +--list-dicts + List available dictionaries and exit. + +--dump-dict + Build custom dictionary (respecting **-d** options). + +--make-dict=dictfile + Write unknown words to *dictfile*. + +-i string, --ignore=regex + Ignore any words matching *regex*. + +-C, --compound + Allow compound words (e.g. **getall**) [default]. + +--no-compound + Do not allow compound words + +-W N, --wordlen=N + Ignore words with <= *N* characters [default: 3]. + +EXIT STATUS +=========== + +* **0** - success; no misspellings found. +* **1** - at least one misspelling found *or* there was an error reading + one or more input file (including encoding errors for non-UTF8 files). +* **2** - invalid command line option(s). + +FILES +===== + +**/usr/share/kodespel/** + The default dictionaries are stored here. + +LIMITATIONS +=========== + +**kodespel** has no option to read from standard input. However, on Linux, +you can run **kodespel** **/dev/stdin**. + +**kodespel** can only handle **UTF-8** encoding (which includes 7-bit **ASCII**). +It will choke on files that use e.g. **ISO-8859** encoding. + +**kodespel** writes its output to **stderr**, not **stdout**. This makes +it difficult to use it from a script. Try e.g:: + + kodespel <args> 2>&1 | <command> + +Also, if you get exit status 1, you can't tell if that's an actual error +or misspellings were found, without examining the actual output. + +COPYRIGHT +========= + +See the file /usr/doc/kodespel-|version|/LICENSE.txt for license information. + +AUTHORS +======= + +kodespel was written by Greg Ward. + +This man page written (mostly copied and adapted from README.md and +the --help output) for the SlackBuilds.org project by B. Watson, and +is licensed under the WTFPL. + +SEE ALSO +======== + +The kodespel homepage: https://pypi.org/project/kodespel/ + +**codespell**\(1) diff --git a/development/kodespel/sbo.dict b/development/kodespel/sbo.dict new file mode 100644 index 0000000000000..e37e84ebfbb8d --- /dev/null +++ b/development/kodespel/sbo.dict @@ -0,0 +1,19 @@ +chmod +chown +dirname +elif +esac +gzip +kodespel +libdirsuffix +makepkg +mtune +perm +pkgdoc +pkgtype +prgnam +sbin +slkcflags +uname +urchlay +wtfpl diff --git a/development/kodespel/slack-desc b/development/kodespel/slack-desc new file mode 100644 index 0000000000000..add677ea5c65e --- /dev/null +++ b/development/kodespel/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +kodespel: kodespel (spell-checker for source code) +kodespel: +kodespel: kodespel is a spellchecker for source code. kodespel's nifty trick +kodespel: is that it knows how to split common programming identifiers like +kodespel: 'getAllStuff' or 'DoThingsNow' or 'num_objects' or 'HTTPResponse' into +kodespel: words, feed those to ispell, and interpret ispell's output. +kodespel: +kodespel: +kodespel: +kodespel: +kodespel: |