[ale] Coding Style
Ed Cashin
ecashin at noserose.net
Mon Oct 15 13:37:34 EDT 2018
A good technique is to find out what linters are the most popular for
the programming language you're interested in, figure out which one
you can work with, and defer to its judgement. Sometimes the linters
even have documentation for the rationales behind their criteria,
which can help soothe the pain of conforming to arbitrary-seeming
rules.
I was about to say I don't know of a good Bourne shell linter, but
shellcheck looks pretty good. I always have to suggest double quoting
to the student workers I'm working with.
https://www.shellcheck.net/
If there's an issue I feel strongly about, but no linter supports
checks for the issue, then I try to get self-critical and to consider
the possibility that perhaps I might be too picky.
On Mon, Oct 15, 2018 at 1:01 PM Scott Plante via Ale <ale at ale.org> wrote:
>
> Back in the early 80s when I was first learning Bourne shell scripting, I was taught to use lower case for script variables. CAPS was strictly for environment variables and that was so they wouldn't conflict with local script variables. I do see a lot of scripts that use caps for all variables, so it doesn't seem to be a widely followed norm but it does make sense to me.
>
> Separately, some languages have clear norms for this stuff. Almost everyone in Java land uses camel case with variables, methods and class attributes starting lower case, Classes starting upper case, and constants (public static final) being ALL_CAPS snake case. Indention and curly brace location is not quite as standardized from what I've seen.
>
> Scott Plante
> ________________________________
> From: "DJ-Pfulio via Ale" <ale at ale.org>
> To: "Charles Shapiro via Ale" <ale at ale.org>
> Sent: Friday, October 12, 2018 11:26:30 AM
> Subject: [ale] Coding Style
>
> OOP - CamelCase. BeginningCaps for methods, classes, camelCase for
> classData.
>
> All others - snake_case.
>
> I use type hints in variable names.
>
> Shell scripting, ALL_CAPS.
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> https://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
--
Ed Cashin <ecashin at noserose.net>
More information about the Ale
mailing list