Skip to content

Commit

Permalink
Fix typo in interface field member and add typing for consts
Browse files Browse the repository at this point in the history
Signed-off-by: Joyce Quach <[email protected]>
  • Loading branch information
jtquach1 committed Oct 23, 2024
1 parent 6e45649 commit daa16e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) {
if (is_control(nisted)) {
url = nisted.canonize({
max_specifiers: 2,
pad_zeros: false,
pad_zeroes: false,
add_spaces: false,
allow_letters: false
});
Expand Down
6 changes: 4 additions & 2 deletions apps/frontend/src/utilities/nist_util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export const nistCanonConfig = {
import {CanonizationConfig} from 'inspecjs';

export const nistCanonConfig: Required<CanonizationConfig> = {
add_spaces: true,
allow_letters: true,
max_specifiers: 5,
pad_zeros: true,
pad_zeroes: true,
add_periods: false,
add_parens: false
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class FromHDFToCAATMapper {

static readonly NistCanonizationConfig: CanonizationConfig = {
max_specifiers: 3,
pad_zeros: true,
pad_zeroes: true,
allow_letters: false,
add_spaces: false
};
Expand Down
8 changes: 4 additions & 4 deletions libs/inspecjs/src/nist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ type ParseNist = NistControl | NistRevision | null;

export interface CanonizationConfig {
max_specifiers?: number; // default 5: $ rg '<number>' SP_800-53_v5_1_XML.xml | awk -F'[^ ]' '{print length($1)}' | sort -nr | head -1 | xargs -I{} expr \( {} - 6 \) / 3 # this equals 5 as of rev5
pad_zeros?: boolean; // default false
pad_zeroes?: boolean; // default false
allow_letters?: boolean; // default true
add_spaces?: boolean; // default true
add_parens?: boolean; // default true
add_periods?: boolean; // default true
}

export const DEFAULT_CANONIZATION_CONFIG = {
export const DEFAULT_CANONIZATION_CONFIG: Required<CanonizationConfig> = {
max_specifiers: 5,
pad_zeros: false,
pad_zeroes: false,
allow_letters: true,
add_spaces: true,
add_parens: true,
Expand Down Expand Up @@ -144,7 +144,7 @@ export class NistControl {
// Handle numbers
if (!Number.isNaN(Number.parseInt(spec))) {
// If we need to, pad zeros
if (config.pad_zeros && spec.length < 2) {
if (config.pad_zeroes && spec.length < 2) {
spec = '0' + spec;
}

Expand Down

0 comments on commit daa16e3

Please sign in to comment.