Add ts-standard static analysis tool#33
Conversation
0fa5fe9 to
d23cf3d
Compare
- Installed ts-standard using npm (package.json)
db0b918 to
cdb0c48
Compare
- Ran npx tsc --init to enable ts-standard usage (tsconfig.json) - Ran npx ts-standard to analyze linting and formatting issues - Redirected output to a text file (ts_standard_output.txt)
cdb0c48 to
89bf127
Compare
marcuswu5
left a comment
There was a problem hiding this comment.
Everything looks good, I think you should submit this pr without ts_standard_output.txt and add it as an attachment instead
Tool Name: ts-standardTool Descriptionts-standard is a linter and automatic code fixer that is a TypeScript equivalent of StandardJS. ts-standard automatically formats code, ensuring code style consistency. ts-standard can catch style issues and programmer errors early. ts-standard utilizes ESLint with the eslint-config-standard-with-typescript sharable configuration, reducing the amount of configuration overhead through fewer required extra dependencies. Source: https://github.com/standard/ts-standardType of Analysis: Static AnalysisProblems Caught by ts-standardts-standard catches style issues (e.g. extra and unexpected punctuation and whitespace), enabling it to enforce code style consistency. ts-standard also catches programming-related errors (e.g. undefined names), reducing the time and effort needed to debug and fix code. These issues are mostly related to formatting, syntactic, and semantic problems. ts-standard utilizes the ESLint set of rules to identify formatting issues in the program. CustomizationThe a priori customization process was simple, only requiring the creation of a tsconfig.json file (TypeScript compiler configuration file) through running the terminal command Integration into Development ProcessIn order to integrate ts-standard into the development process, complete the following steps. First, access the top-level package.json file in the NodeBB codebase. Next, in package.json, update the If there are files that should be ignored by the ts-standard linter, a separate root ts-standard is useful and should be integrated into the development process, as it can fix style issues and programming-related errors for both JavaScript and TypeScript files. ts-standard enforces code style consistency, improving code readability and organization. ts-standard can also catch errors early, reducing time and effort needed to fix code errors and bugs. Reflection on False Positives, False Negatives, Unnecessary True Positivests-standard has a specified set of rules for code style formatting. The set of style formatting rules are derived from the ESLint documentation. Examples of rules include 2-space indentation, no extra semicolons and parentheses, and no trailing whitespace at the end of lines. ts-standard strictly enforces these formatting rules. As a result, no false positives were observed. However, there is always a possibility of false positives, where specific formatting choices seem off but are necessary. These formatting rules may conflict with developer intentions and preferences (e.g. some developers may want to include tabs instead of spaces). It is important to note that ts-standard is limited to basic static analysis and is not ideal for detecting deeper logical errors, so ts-standard should be used alongside other tools. These limitations can lead to ts-standard missing deeper programming errors, resulting in potential false negatives. The true positives that were provided in the ts-standard output were important and necessary for the development process. This is likely because the information provided by ts-standard provides useful insight into the specific formatting issues within the program (e.g. unexpected punctuation, inconsistent spacing, undefined variables). These formatting issues (especially with spacing) can be overlooked by developers, so these issue reports are significant to the development workflow and process. |
Proof of Installation
npm install ts-standardnpm install ts-standardArtifacts
npx ts-standard > ts_standard_output.txt 2>&12>&1nano ts_standard_output.txtafter ts-standard is run.Pros and Cons of ts-standard
npx ts-standard --fixto display file changes, there are 870 files changed, 122502 insertions, and 122793 deletions. These values demonstrate the extensive ability of ts-standard in fixing a high quantity of linting and formatting issues.git restore .was run afterward to ensure that the codebase remained unchanged from this evaluation.npx tsc --init. No additional customization was required over time as ts-standard was used.