Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell config + github action, run and fix a good number of typos #3645

Merged
merged 8 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
skip = .git,*.pdf,*.svg,yarn.lock,*.min.js,locales
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh does this mean it will run on js, ts, jsx, and tsx files too? How powerful is it to not mess around with real js code and only fix typos in the function documents

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, you can see how well it did so far ;)

indeed JS and alike are typically trickier but not entirely hopeless -- worse comes to worse you can disable for those if starts bothering. codespell doesn't do any programming language specific parsing -- so can't tell code from documentation. Just extracts words and finds typos in the words.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great explanation thanks again!

# ignore words ending with … and some camelcased variables and names
ignore-regex = \b\S+…\S*|\b(doubleClick|afterAll|PostgresSQL)\b|\bWee, L\.|.*te.*Telugu.*
# some odd variables
ignore-words-list = datea,ser,childrens
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion extensions/cornerstone-dicom-sr/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const dicomSRExtension = {
},
getCommandsModule,
getSopClassHandlerModule,
// Include dynmically computed values such as toolNames not known till instantiation
// Include dynamically computed values such as toolNames not known till instantiation
getUtilityModule({ servicesManager }) {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const isStructuredReportSeries = series => {
};

/**
* Checkes if series1 is newer than series2
* Checks if series1 is newer than series2
*
* @param {Object} series1 - Series Metadata 1
* @param {Object} series2 - Series Metadata 2
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/Viewport/Overlays/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function formatPN(name) {
* Gets compression type
*
* @param {number} imageId
* @returns {string} comrpession type.
* @returns {string} compression type.
*/
export function getCompression(imageId) {
const generalImageModule = metaData.get('generalImageModule', imageId) || {};
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const setEnabledElement = (viewportId: string, element: HTMLElement, context?: s
};

/**
* Grabs the enabled element `dom` reference of an ative viewport.
* Grabs the enabled element `dom` reference of an active viewport.
*
* @return {HTMLElement} Active viewport element.
*/
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/utils/getInterleavedFrames.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function getInterleavedFrames(imageIds) {
!prefetchQueuedFilled.currentPositionUpToMaximum
) {
if (!prefetchQueuedFilled.currentPositionDownToMinimum) {
// Add imageId bellow
// Add imageId below
lowerImageIdIndex--;
imageIdsToPrefetch.push({
imageId: imageIds[lowerImageIdIndex],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default class ContextMenuController {
event,
content: ContextMenu,

// This naming is part of hte uiDialogService convention
// Clicking outside simpy closes the dialog box.
// This naming is part of the uiDialogService convention
// Clicking outside simply closes the dialog box.
onClickOutside: () => this.services.uiDialogService.dismiss({ id: 'context-menu' }),

contentProps: {
Expand Down
4 changes: 2 additions & 2 deletions extensions/default/src/CustomizableContextMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Types } from '@ohif/core';
* menu item for display.
* An instance of SelectorProps is provided to the selector functions, which
* return true to include the item or false to exclude it.
* The point of this is to allow more specific conext menus which hide
* The point of this is to allow more specific context menus which hide
* non-relevant menu options, optimizing the speed of selection of menus
*/
export interface SelectorProps {
Expand Down Expand Up @@ -69,7 +69,7 @@ export interface MenuItem {
// or more importantly, if the delegating subMenu will be included.
selector?: (props: SelectorProps) => boolean;

/** Adapts the item by filling in additional properties as requried */
/** Adapts the item by filling in additional properties as required */
adaptItem?: (item: MenuItem, props: ContextMenuProps) => UIMenuItem;

/** List of commands to run when this item's action is taken. */
Expand Down
2 changes: 1 addition & 1 deletion extensions/default/src/DicomWebDataSource/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
const addRetrieveBulkData = instance => {
const naturalized = naturalizeDataset(instance);

// if we konw the server doesn't use bulkDataURI, then don't
// if we know the server doesn't use bulkDataURI, then don't
if (!dicomWebConfig.bulkDataURI?.enabled) {
return naturalized;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const StudyMetaDataPromises = new Map();
*
* @param {Object} server Object with server configuration parameters
* @param {string} StudyInstanceUID The UID of the Study to be retrieved
* @param {boolean} enabledStudyLazyLoad Whether the study metadata should be loaded asynchronusly.
* @param {boolean} enabledStudyLazyLoad Whether the study metadata should be loaded asynchronously.
* @param {function} storeInstancesCallback A callback used to store the retrieved instance metadata.
* @param {Object} [filters] - Object containing filters to be applied on retrieve metadata process
* @param {string} [filter.seriesInstanceUID] - series instance uid to filter results against
Expand Down
4 changes: 2 additions & 2 deletions extensions/default/src/Panels/PanelMeasurementTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function PanelMeasurementTable({
? 'Research Derived Series' // default
: promptResult.value; // provided value

// Re-use an existing series having the same series description to avoid
// Reuse an existing series having the same series description to avoid
// creating too many series instances.
const options = findSRWithSameSeriesDescription(SeriesDescription, displaySetService);

Expand Down Expand Up @@ -236,7 +236,7 @@ function _getMappedMeasurements(measurementService) {

/**
* Map the measurements to the display text.
* Adds finding and site inforamtion to the displayText and/or label,
* Adds finding and site information to the displayText and/or label,
* and provides as 'displayText' and 'label', while providing the original
* values as baseDisplayText and baseLabel
*/
Expand Down
2 changes: 1 addition & 1 deletion extensions/default/src/commandsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const commandsModule = ({
stateSyncReduce;

if (!protocolId) {
// Re-use the previous protocol id, and optionally stage
// Reuse the previous protocol id, and optionally stage
protocolId = hpInfo.protocolId;
if (stageId === undefined && stageIndex === undefined) {
stageIndex = hpInfo.stageIndex;
Expand Down
2 changes: 1 addition & 1 deletion extensions/default/src/findViewportsByPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StateSyncService } from '@ohif/core';
/**
* This find or create viewport is paired with the reduce results from
* below, and the action of this viewport is to look for previously filled
* viewports, and to re-use by position id. If there is no filled viewport,
* viewports, and to reuse by position id. If there is no filled viewport,
* then one can be re-used from the display set if it isn't going to be displayed.
* @param hangingProtocolService - bound parameter supplied before using this
* @param viewportsByPosition - bound parameter supplied before using this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function _getDisplaySetsFromSeries(instances, servicesManager, extensionManager)
const instance = instances[0];

// TODO ! Consumption of DICOMMicroscopySRSOPClassHandler to a derived dataset or normal dataset?
// TOOD -> Easy to swap this to a "non-derived" displaySet, but unfortunately need to put it in a different extension.
// TODO -> Easy to swap this to a "non-derived" displaySet, but unfortunately need to put it in a different extension.
const naturalizedDataset = DicomMetadataStore.getSeries(
instance.StudyInstanceUID,
instance.SeriesInstanceUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function formatPN(name) {
* Gets compression type
*
* @param {number} imageId
* @returns {string} comrpession type.
* @returns {string} compression type.
*/
export function getCompression(imageId) {
const generalImageModule = cornerstone.metaData.get('generalImageModule', imageId) || {};
Expand Down
4 changes: 2 additions & 2 deletions extensions/dicom-microscopy/src/services/MicroscopyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class MicroscopyService extends PubSubService {
}

/**
* Cleares all the annotations and managed viewers, setting the manager state
* Clears all the annotations and managed viewers, setting the manager state
* to its initial state
*/
clear() {
Expand Down Expand Up @@ -357,7 +357,7 @@ export default class MicroscopyService extends PubSubService {

/**
* Removes the given third-party viewer API's object from the managed viewers
* and cleares all its event subscriptions
* and clears all its event subscriptions
*
* @param {Object} viewer Third-party viewer API's object to be removed
*/
Expand Down
4 changes: 2 additions & 2 deletions extensions/dicom-microscopy/src/tools/viewerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ViewerManager extends PubSubService {
}

/**
* Cleares all the relevant event handlers for the third-party API
* Clears all the relevant event handlers for the third-party API
*/
unregisterEvents() {
this.container.removeEventListener(ApiEvents.ROI_ADDED, this.onRoiAdded);
Expand Down Expand Up @@ -205,7 +205,7 @@ class ViewerManager extends PubSubService {
* @param {String} label The label of the annotation.
*/
addRoiGraphicWithLabel(roiGraphic, label) {
// NOTE: Dicom Microscopy Viewer will override styles for "Text" evalutations
// NOTE: Dicom Microscopy Viewer will override styles for "Text" evaluations
// to hide all other geometries, we are not going to use its label.
// if (label) {
// if (!roiGraphic.properties) roiGraphic.properties = {};
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-microscopy/src/utils/RoiAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class RoiAnnotation extends PubSubService {
/**
* Returns the geometry type of the annotation concatenated with the label
* defined for the annotation.
* Difference with getDetailedLabel() is that this will return empty string for empy
* Difference with getDetailedLabel() is that this will return empty string for empty
* label.
*
* @returns {String} Text with geometry type and label
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-microscopy/src/utils/loadSR.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function loadSR(
// NOTE: When saving Microscopy SR, we are attaching identifier property
// to each ROI, and when read for display, it is coming in as "TEXT"
// evaluation.
// As the Dicom Microscopy Viewer will override styles for "Text" evalutations
// As the Dicom Microscopy Viewer will override styles for "Text" evaluations
// to hide all other geometries, we are going to manually remove that
// evaluation item.
const roi = rois[i];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//We are keeping the hardcoded results values for the study list tests
//this is intended to be running in a controled docker environment with test data.
//this is intended to be running in a controlled docker environment with test data.
describe('OHIF Study List', function () {
context('Desktop resolution', function () {
beforeEach(function () {
Expand Down
2 changes: 1 addition & 1 deletion platform/app/cypress/support/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function initStudyListAliasesOnDesktop() {
cy.get('[data-cy="study-list-results"] > tr').as('searchResult2');

// We can't use data attributes (e.g. data--cy) for these since
// they are using third party libraires (i.e. react-dates, react-select)
// they are using third party libraries (i.e. react-dates, react-select)
cy.get('#date-range-studyDate-start-date').as('studyListStartDate');
cy.get('#date-range-studyDate-end-date').as('studyListEndDate');
cy.get('#input-modalities').as('modalities');
Expand Down
2 changes: 1 addition & 1 deletion platform/app/public/_redirects
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Specific to our deploy-preview
# Our docs are published using CircleCI + GitBook
# Confgure redirects using netlify.toml
# Configure redirects using netlify.toml

# Spa
/* /index.html 200
2 changes: 1 addition & 1 deletion platform/app/src/__tests__/globalSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const _ = require('lodash');
const originalConsoleError = console.error;

// JSDom's CSS Parser has limited support for certain features
// This supresses error warnings caused by it
// This suppresses error warnings caused by it
console.error = function (msg) {
if (_.startsWith(msg, 'Error: Could not parse CSS stylesheet')) {
return;
Expand Down
2 changes: 1 addition & 1 deletion platform/app/src/appInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {

const loadedModes = await loadModules([...(appConfig.modes || []), ...defaultModes]);

// This is the name for the loaded istance object
// This is the name for the loaded instance object
appConfig.loadedModes = [];
const modesById = new Set();
for (let i = 0; i < loadedModes.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion platform/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ implementation][react-viewer].

### Install

> This library is pre- v1.0. All realeases until a v1.0 have the possibility of
> This library is pre- v1.0. All releases until a v1.0 have the possibility of
> introducing breaking changes. Please depend on an "exact" version in your
> projects to prevent issues caused by loose versioning.

Expand Down
2 changes: 1 addition & 1 deletion platform/core/src/classes/MetadataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ const WADO_IMAGE_LOADER_TAGS = {
OVERLAY_PLANE_MODULE: 'overlayPlaneModule',
PATIENT_DEMOGRAPHIC_MODULE: 'patientDemographicModule',

// react-cornerstone-viewport specifc
// react-cornerstone-viewport specific
PATIENT_MODULE: 'patientModule',
GENERAL_IMAGE_MODULE: 'generalImageModule',
GENERAL_STUDY_MODULE: 'generalStudyModule',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export default class HangingProtocolService extends PubSubService {
* @param params is the dataset to run the hanging protocol on.
* @param params.activeStudy is the "primary" study to hang This may or may
* not be displayed by the actual viewports.
* @param params.studies is the list of studies to hang. If absent, will re-use the previous set.
* @param params.studies is the list of studies to hang. If absent, will reuse the previous set.
* @param params.displaySets is the list of display sets associated with
* the studies to display in viewports.
* @param protocol is a specific protocol to apply.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class MeasurementService extends PubSubService {
};

if (oldMeasurement) {
// TODO: Ultimately, each annotation should have a selected flag right from the soure.
// TODO: Ultimately, each annotation should have a selected flag right from the source.
// For now, it is just added in OHIF here and in setMeasurementSelected.
this.measurements.set(internalUID, newMeasurement);
if (isUpdate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const EVENTS = {};
type Obj = Record<string, unknown>;

type StateConfig = {
/** clearOnModeExit defines state configuraion that is cleared automatically on
/** clearOnModeExit defines state configuration that is cleared automatically on
* exiting a mode. This clearing occurs after the mode onModeExit,
* so it is possible to preserve desired state during exit to be restored
* later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class ToolbarService extends PubSubService {
// unsubscribe = commandsManager.runCommand(commandName, commandOptions);
// }

// // Storing the unsubscribe for later reseting
// // Storing the unsubscribe for later resetting
// if (unsubscribe && typeof unsubscribe === 'function') {
// if (this.unsubscriptions.indexOf(unsubscribe) === -1) {
// this.unsubscriptions.push(unsubscribe);
Expand Down
2 changes: 1 addition & 1 deletion platform/core/src/types/HangingProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export type ProtocolNotifications = {
* It is a set of rules about when the protocol can be applied at all,
* as well as a set of stages that represent indivividual views.
* Additionally, the display set selectors are used to choose from the existing
* display sets. The hanging protcol definition here does NOT allow
* display sets. The hanging protocol definition here does NOT allow
* redefining the display sets to use, but only selects the views to show.
*/
export type Protocol = {
Expand Down
2 changes: 1 addition & 1 deletion platform/core/src/utils/Queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class Queue {
/**
* Creates a new "proxy" function associated with the current execution queue
* instance. When the returned function is invoked, the queue limit is checked
* to make sure the limit of scheduled tasks is repected (throwing an
* to make sure the limit of scheduled tasks is respected (throwing an
* exception when the limit has been reached and before calling the original
* function). The original function is only invoked after all the previously
* scheduled tasks have finished executing (their returned promises have
Expand Down
4 changes: 2 additions & 2 deletions platform/core/src/utils/hierarchicalListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function addToList(list, ...values) {
* once for each leaf-node of the tree. The ancestors of the leaf-node being
* visited are passed to the callback function along with the leaf-node in
* the exact same order they appear on the tree (from root to leaf);
* @ For example, if the hierachy `a > b > c` appears on the tree ("a" being
* @ For example, if the hierarchy `a > b > c` appears on the tree ("a" being
* the root and "c" being the leaf) the callback function will be called as:
* callback('a', 'b', 'c');
* @param {Array} list The hierarchical list to be iterated
* @param {function} callback The callback which will be exected once for
* @param {function} callback The callback which will be executed once for
* each leaf-node of the hierarchical list;
* @returns {Array} Returns the provided list or null for bad arguments;
*/
Expand Down
2 changes: 1 addition & 1 deletion platform/core/src/utils/objectPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class ObjectPath {
* @param path {String} A string representing the property to be set, e.g. "user.study.series.timepoint".
* @param value {Any} The value of the property that will be set.
* @return {Boolean} Returns "true" on success, "false" if any intermediate component of the supplied path
* ... is not a valid Object, in which case the property cannot be set. No excpetions are thrown.
* ... is not a valid Object, in which case the property cannot be set. No exceptions are thrown.
*/
static set(object, path, value) {
let components = ObjectPath.getPathComponents(path),
Expand Down
6 changes: 3 additions & 3 deletions platform/core/src/utils/progressTrackingUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function finish(task) {
/**
* Generate a summarized snapshot of the current status of the given task List
* @param {Object} list The List instance to be scanned
* @returns {Object} An obeject representing the summarized status of the list
* @returns {Object} An object representing the summarized status of the list
*/
function getOverallProgress(list) {
const status = createStatus();
Expand Down Expand Up @@ -223,7 +223,7 @@ function getTaskByName(list, name) {
* @param {Object} list The List instance to which the observer will be appended
* @param {Function} observer The observer (function) that will be executed
* every time a change happens within the list
* @returns {boolean} Returns true on success and false otherewise
* @returns {boolean} Returns true on success and false otherwise
*/
function addObserver(list, observer) {
if (isList(list) && Array.isArray(list.observers) && typeof observer === 'function') {
Expand All @@ -237,7 +237,7 @@ function addObserver(list, observer) {
* Removes an observer (callback function) from a given List instance
* @param {Object} list The instance List from which the observer will removed
* @param {Function} observer The observer function to be removed
* @returns {boolean} Returns true on success and false otherewise
* @returns {boolean} Returns true on success and false otherwise
*/
function removeObserver(list, observer) {
if (isList(list) && Array.isArray(list.observers) && list.observers.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion platform/core/src/utils/splitComma.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Splits a list of stirngs by commas within the strings */
/** Splits a list of strings by commas within the strings */
const splitComma = (strings: string[]): string[] => {
if (!strings) {
return null;
Expand Down
Loading