code standards #2
Replies: 2 comments 2 replies
-
I take it you mean column limit, just do what you think is sensible
Question for Paul I think
We use eslint - see here
Looking back at what I've written to date I've not been consistent with this, its not strictly necessary to write 'variable : type' as the type can be inferred. I usually specify the type if I think it lends clarity to the code.
Best practices would have use document all functions but its just sooo tedious and the code is always self-documenting, right? :) I think Paul is in the process of generating some documentation for the API at least (which is Java and uses the '@operation' annotation). For the GUI maybe we should comment on the input parameters and return values for the exported functions at least? |
Beta Was this translation helpful? Give feedback.
-
On the 80 character limit for lines, to be clear I didn't want it being imposed as a hard limit. I get that "just do what you think is sensible" is vague and subject to opinion so I'll be more clear. What I meant was on modern monitors going up to 100-120 characters is fine so long as the code is readable. Again, "readable" is subject to opinion but having a hard limit of 80 characters feels unnecessarily restrictive (a hangover from punch cards and teletypewriters, technology moves on). Looking back through the code these limits are usually exceeded due to long string literals. However, (and I have just read this), you can use backticks (`) for block strings in Typescript, and a triple double-quote marks (""") for block strings in Java*, so perhaps we should do that. *apparently only for Java 15+ |
Beta Was this translation helpful? Give feedback.
-
Is there a line limit we're working towards? Id personally prefer 80 as it allows me to have a split screen in InjellIj and not have to scroll to see the entire code. But thats just my own preference
Is there any copy-write expectations for the code? as I've yet to see any files with copy-write at the top of the file.
Is there any conventions we're trying to work with (aka TSlint? Eslint?)?
Is there expectations in terms of type definitions? aka, variable: type
Is there any expectation of documenting the functions?
Beta Was this translation helpful? Give feedback.
All reactions