Skip to content

Commit

Permalink
Merge pull request #2295 from yarikoptic/enh-codespell
Browse files Browse the repository at this point in the history
codespell: config, workflow (fail if typos introduced) and some typos fixed
  • Loading branch information
robertoostenveld committed Aug 17, 2023
2 parents 298c7c2 + eee3da4 commit 67d7913
Show file tree
Hide file tree
Showing 50 changed files with 100 additions and 66 deletions.
10 changes: 10 additions & 0 deletions .codespellrc
@@ -0,0 +1,10 @@
[codespell]
skip = .git,*.pdf,*.svg,external,src
ignore-words-list = ans,cfg,siz,pnt,pos,ori,ext,dum,siz,toi,homogenous,whos,nas,ini,lpa,rpa,als,ali,ars,ari,pls,pli,prs,pri,las,lai,ras,rai,lps,lpi,rps,rpi,asl,ail,asr,air,psl,pil,psr,pir,sal,ial,sar,iar,spl,ipl,spr,ipr,sla,ila,sra,ira,slp,ilp,srp,irp,lsa,lia,rsa,ria,lsp,lip,rsp,rip

# case sensitive etc as regex
# ignore-regex = \b(ALS|correctT)\b|n\(ot a

# there is no files option yet: https://github.com/codespell-project/codespell/issues/2758
# but for now - running codespell only for utilities
# files = utilites
24 changes: 24 additions & 0 deletions .github/workflows/codespell.yml
@@ -0,0 +1,24 @@
---
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
with:
path: utilities
2 changes: 1 addition & 1 deletion utilities/dccnpath.m
Expand Up @@ -49,7 +49,7 @@
filename = strrep(filename,'\','/');
end

% alternative1 alllows to test with local files in the present working directory
% alternative1 allows to test with local files in the present working directory
% this is often convenient when initially setting up a new test script while the data is not yet uploaded
[p, f, x] = fileparts(filename);
alternative1 = [f x];
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_average_sens.m
Expand Up @@ -81,7 +81,7 @@
x1 = pos*u(:, 2);
x2 = pos*u(:, 1);

% detemine the indices of three reference sensors that are close to the three principal axes
% determine the indices of three reference sensors that are close to the three principal axes
[dum, ind1] = min(x1);
[dum, ind2] = max(x1);
[dum, ind3] = max(abs(x2 - mean(x2([ind1 ind2]))));
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_channelcombination.m
Expand Up @@ -100,7 +100,7 @@
else
% a combination is made for each row of the input selection after
% translating the channel group (such as 'all') to the proper channel names
% and within each set, double occurences and autocombinations are removed
% and within each set, double occurrences and autocombinations are removed

selmat = false(numel(datachannel));
for sel=1:size(channelcmb,1)
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_channelselection.m
Expand Up @@ -244,7 +244,7 @@
end

if ~isempty(findreg)
findreg = unique(findreg); % remove multiple occurances due to multiple wildcards
findreg = unique(findreg); % remove multiple occurrences due to multiple wildcards
labelreg = datachannel(labelreg);
end

Expand Down Expand Up @@ -448,7 +448,7 @@
findspike = find(strcmpi(channel, 'spike'));
findgui = find(strcmpi(channel, 'gui'));

% remove any occurences of groups in the channel list
% remove any occurrences of groups in the channel list
channel([
findall
findreg
Expand Down
10 changes: 5 additions & 5 deletions utilities/ft_checkconfig.m
Expand Up @@ -308,7 +308,7 @@
if silent
% don't mention it
elseif loose
ft_warning('The field cfg.%s.%s is deprecated, pleae use cfg.%s\n', subname, fieldname{i}, fieldname{i});
ft_warning('The field cfg.%s.%s is deprecated, please use cfg.%s\n', subname, fieldname{i}, fieldname{i});
elseif pedantic
ft_error('The field cfg.%s.%s is not longer supported, please use cfg.%s\n', subname, fieldname{i}, fieldname{i});
end
Expand All @@ -321,7 +321,7 @@
if silent
% don't mention it
elseif loose
ft_warning('The field cfg.%s.%s is deprecated, pleae use cfg.%s\n', subname, fieldname{i}, fieldname{i});
ft_warning('The field cfg.%s.%s is deprecated, please use cfg.%s\n', subname, fieldname{i}, fieldname{i});
elseif pedantic
ft_error('The field cfg.%s.%s is not longer supported, please use cfg.%s\n', subname, fieldname{i}, fieldname{i});
end
Expand All @@ -347,7 +347,7 @@
% them in a separate substructure.
%
% This is to ensure backward compatibility of end-user scripts, FieldTrip functions
% and documentation that do not use the nested detailled configuration but that use a
% and documentation that do not use the nested detailed configuration but that use a
% flat configuration.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~isempty(createsubcfg)
Expand Down Expand Up @@ -574,7 +574,7 @@
if silent
% don't mention it
elseif loose
ft_warning('The field cfg.%s is deprecated, pleae use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
ft_warning('The field cfg.%s is deprecated, please use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
elseif pedantic
ft_error('The field cfg.%s is not longer supported, please use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
end
Expand All @@ -587,7 +587,7 @@
if silent
% don't mention it
elseif loose
ft_warning('The field cfg.%s is deprecated, pleae use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
ft_warning('The field cfg.%s is deprecated, please use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
elseif pedantic
ft_error('The field cfg.%s is not longer supported, please use cfg.%s.%s\n', fieldname{i}, subname, fieldname{i});
end
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_checkdata.m
@@ -1,7 +1,7 @@
function [data] = ft_checkdata(data, varargin)

% FT_CHECKDATA checks the input data of the main FieldTrip functions, e.g. whether the
% type of data strucure corresponds with the required data. If necessary and possible,
% type of data structure corresponds with the required data. If necessary and possible,
% this function will adjust the data structure to the input requirements (e.g. change
% dimord, average over trials, convert inside from index into logical).
%
Expand Down Expand Up @@ -63,7 +63,7 @@
%
% $Id$

% in case of an error this function could use dbstack for more detailled
% in case of an error this function could use dbstack for more detailed
% user feedback
%
% this function should replace/encapsulate
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_compile_mex.m
Expand Up @@ -8,7 +8,7 @@ function ft_compile_mex(force)
% path. Subsequently you can rtun this function to recompile it on your platform with
% your compiler settings
%
% The standards procedure for compiling mex files is detailled on
% The standards procedure for compiling mex files is detailed on
% http://www.fieldtriptoolbox.org/development/guidelines/code#compiling_mex_files
%
% Please note that this script does NOT set up your MEX environment for you, so in
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_datatype_comp.m
Expand Up @@ -11,8 +11,8 @@
% An example of a decomposed raw data structure with 100 components that resulted from
% a 151-channel MEG recording is shown here:
%
% topo: [151x100 double] the compoment topographies
% unmixing: [100x151 double] the compoment unmixing matrix
% topo: [151x100 double] the component topographies
% unmixing: [100x151 double] the component unmixing matrix
% topolabel: {151x1 cell} the channel labels (e.g. 'MRC13')
% label: {100x1 cell} the component labels (e.g. 'runica001')
% time: {1x10 cell} the time axis [1*Ntime double] per trial
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_datatype_dip.m
Expand Up @@ -2,7 +2,7 @@

% FT_DATATYPE_DIP descripts the FieldTrip MATLAB structure for dip data
%
% The dip structure reprents a dipole model that has been fitted to
% The dip structure represents a dipole model that has been fitted to
% ERP or ERF data using a non-linear optimization approach. It is
% usually generated by the FT_DIPOLEFITTING function.
%
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_datatype_freq.m
Expand Up @@ -10,7 +10,7 @@
% and 120 frequencies is
%
% dimord: 'chan_freq' defines how the numeric data should be interpreted
% powspctrm: [306x120 double] the power spectum
% powspctrm: [306x120 double] the power spectrum
% label: {306x1 cell} the channel labels
% freq: [1x120 double] the frequencies expressed in Hz
% cfg: [1x1 struct] the configuration used by the function that generated this data structure
Expand All @@ -20,7 +20,7 @@
% and 60 timepoints is
%
% dimord: 'chan_freq_time' defines how the numeric data should be interpreted
% powspctrm: [306x120x60 double] the power spectum
% powspctrm: [306x120x60 double] the power spectrum
% label: {306x1 cell} the channel labels
% freq: [1x120 double] the frequencies, expressed in Hz
% time: [1x60 double] the time, expressed in seconds
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_datatype_parcellation.m
Expand Up @@ -7,7 +7,7 @@
% A parcellation describes the tissue types for each of the surface elements.
% Parcellations are often, but not always labeled. A parcellatoin can be used to
% estimate the activity from MEG data in a known region of interest. A surface-based
% atlas is basically a very detailled parcellation with an anatomical label for each
% atlas is basically a very detailed parcellation with an anatomical label for each
% vertex.
%
% An example of a surface based Brodmann parcellation looks like this
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_datatype_raw.m
Expand Up @@ -42,7 +42,7 @@
% (2010v1) In 2010/Q3 it shortly contained the trialdef field which was a copy
% of the trial definition (trl) is generated by FT_DEFINETRIAL.
%
% (2007) It used to contain the offset field, which correcponds to trl(:,3).
% (2007) It used to contain the offset field, which corresponds to trl(:,3).
% Since the offset field is redundant with the time axis, the offset field is
% from now on not present any more. It can be recreated if needed.
%
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_datatype_spike.m
Expand Up @@ -38,7 +38,7 @@
% FT_SPIKE_MAKETRIALS function can be used to reorganise the SPIKE
% structure such that the spike times are expressed relative to a trigger
% instead of relative to the acquisition devices internal timestamp clock.
% The time field then contains only those spikes that ocurred within one of
% The time field then contains only those spikes that occurred within one of
% the trials . The spike times are now expressed on seconds relative to the
% trigger.
%
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_datatype_volume.m
Expand Up @@ -45,7 +45,7 @@
% with it here. However, keep this snippet of code for reference.
%
% (2011) The dimord field was deprecated and we agreed that volume
% data should be 3-dimensional and not N-dimensional with arbitary
% data should be 3-dimensional and not N-dimensional with arbitrary
% dimensions. In case time-frequency recolved data has to be represented
% on a 3-d grid, the source representation should be used.
%
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_determine_coordsys.m
Expand Up @@ -19,7 +19,7 @@
% axisscale = scaling factor for the reference axes and sphere (default = 1)
% clim = lower and upper anatomical MRI limits (default = [0 1])
%
% This function wil pop up a figure that allows you to check whether the
% This function will pop up a figure that allows you to check whether the
% alignment of the object relative to the coordinate system axes is correct
% and what the anatomical labels of the coordinate system axes are. You
% should switch on the 3D rotation option in the figure panel to rotate and
Expand Down Expand Up @@ -65,7 +65,7 @@
dtype = ft_datatype(data);

% the high-level data structures are detected with ft_datatype, but there are
% also some low-level data structures that need to be supproted here
% also some low-level data structures that need to be supported here
if strcmp(dtype, 'unknown')
if isfield(data, 'fid') || (isfield(data, 'tri') && isfield(data, 'pos'))
dtype = 'headshape';
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_fetch_data.m
Expand Up @@ -168,7 +168,7 @@
ft_error('some of the requested samples occur twice in the data and have conflicting values');
end
% Otherwise rises a warning and exits the loop.
ft_warning('some of the requested samples occur twice in the data and have conflicting values, using only the last occurence of each sample');
ft_warning('some of the requested samples occur twice in the data and have conflicting values, using only the last occurrence of each sample');
break
end
end
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_hastoolbox.m
Expand Up @@ -652,7 +652,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function status = hasfunction(funname, toolbox)
try
% call the function without any input arguments, which probably is inapropriate
% call the function without any input arguments, which probably is inappropriate
feval(funname);
% it might be that the function without any input already works fine
status = true;
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_headcoordinates.m
Expand Up @@ -75,7 +75,7 @@
% the origin is the intersection of the line through LPA and RPA and a line orthogonal to L passing through the nasion
%
% The ASA coordinate system is defined as follows:
% the origin is at the orthogonal intersection of the line from rpa-lpa and the line trough nas
% the origin is at the orthogonal intersection of the line from rpa-lpa and the line through nas
% the X-axis goes towards nas
% the Y-axis goes through rpa and lpa
% the Z-axis goes approximately towards the vertex, orthogonal to X and Y
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_platform_supports.m
Expand Up @@ -16,7 +16,7 @@
% 'onCleanup' onCleanup(...)
% 'alim' alim(...)
% 'int32_logical_operations' bitand(a,b) with a, b of type int32
% 'graphics_objects' graphics sysem is object-oriented
% 'graphics_objects' graphics system is object-oriented
% 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++)
% 'images' all image processing functions in FieldTrip's external/images directory
% 'signal' all signal processing functions in FieldTrip's external/signal directory
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_postamble.m
Expand Up @@ -33,7 +33,7 @@ function ft_postamble(cmd, varargin)

% ideally this would be a script, because the local variables would then be
% shared with the calling function. Instead, this is a function which then
% passes the variables explicitely to another script which is eval'ed.
% passes the variables explicitly to another script which is eval'ed.

% the following section ensures that these scripts are included as
% dependencies when using the MATLAB compiler
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_preamble.m
Expand Up @@ -33,7 +33,7 @@ function ft_preamble(cmd, varargin)

% ideally this would be a script, because the local variables would then be
% shared with the calling function. Instead, this is a function which then
% passes the variables explicitely to another script which is eval'ed.
% passes the variables explicitly to another script which is eval'ed.

% the following section ensures that these scripts are included as
% dependencies when using the MATLAB compiler
Expand Down
8 changes: 4 additions & 4 deletions utilities/ft_selectdata.m
Expand Up @@ -34,7 +34,7 @@
% cfg.nanmean = string, can be 'yes' or 'no' (default = 'no')
%
% When you average over a dimension, you can choose whether to keep that dimension in
% the data representation or remove it alltogether.
% the data representation or remove it altogether.
% cfg.keeprptdim = 'yes' or 'no' (default is automatic)
% cfg.keepchandim = 'yes' or 'no' (default = 'yes')
% cfg.keepchancmbdim = 'yes' or 'no' (default = 'yes')
Expand Down Expand Up @@ -509,7 +509,7 @@
switch selmode
case 'intersect'
if iscell(selindx)
% there are multiple selections in multipe vectors, the selection is in the matrices contained within the cell-array
% there are multiple selections in multiple vectors, the selection is in the matrices contained within the cell-array
for j=1:numel(selindx)
if ~isempty(selindx{j}) && all(isnan(selindx{j}))
% no selection needs to be made
Expand Down Expand Up @@ -999,7 +999,7 @@
end

elseif numel(cfg.latency)==2
% the [min max] range can be specifed with +inf or -inf, but should
% the [min max] range can be specified with +inf or -inf, but should
% at least partially overlap with the time axis of the input data
mintime = min(alltimevec);
maxtime = max(alltimevec);
Expand Down Expand Up @@ -1137,7 +1137,7 @@
end

elseif numel(cfg.frequency)==2
% the [min max] range can be specifed with +inf or -inf, but should
% the [min max] range can be specified with +inf or -inf, but should
% at least partially overlap with the freq axis of the input data
minfreq = min(freqaxis);
maxfreq = max(freqaxis);
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_setopt.m
Expand Up @@ -49,7 +49,7 @@
valindex = keyindex+1;
opt{valindex} = val;
elseif length(sel)>1
% first remove all occurences
% first remove all occurrences
keyindex = 2*sel-1;
valindex = keyindex+1;
opt([keyindex valindex]) = [];
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_standalone.m
Expand Up @@ -18,7 +18,7 @@ function ft_standalone(varargin)
% ft_standalone --option value scriptname.m
% or on the Linux/macOS command line
% fieldtrip.sh <MATLABROOT> --option value scriptname.m
% The options and their values are automaticallly made available as local
% The options and their values are automatically made available as local
% variables in the script execution environment.
%
% See also FT_COMPILE_STANDALONE
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_transform_geometry.m
Expand Up @@ -129,7 +129,7 @@

% tfields must be rotated, translated and scaled
% rfields must only be rotated
% mfields must be simply multipied
% mfields must be simply multiplied
% recfields must be recursed into
tfields = {'pos' 'pnt' 'o' 'coilpos' 'elecpos' 'optopos' 'chanpos' 'chanposold' 'nas' 'lpa' 'rpa' 'zpoint'}; % apply rotation plus translation
rfields = {'ori' 'nrm' 'coilori' 'elecori' 'optoori' 'chanori' 'chanoriold' 'mom' }; % only apply rotation
Expand Down
4 changes: 2 additions & 2 deletions utilities/ft_warp_error.m
Expand Up @@ -6,7 +6,7 @@
% Use as
% dist = ft_warp_error(M, input, target, 'method')
%
% It returns the mean Euclidian distance (i.e. the residual) for an interative
% It returns the mean Euclidean distance (i.e. the residual) for an interactive
% optimalization to transform the input towards the target using the
% transformation M with the specified warping method.
%
Expand Down Expand Up @@ -56,7 +56,7 @@
% this is done here in one step, but can also be done in separate steps (see example code below)
el = project_elec(input, target.pos, target.tri);
dist = mean(el(:,4));
% the following example code is more elaborate, and can be used for detailled testing
% the following example code is more elaborate, and can be used for detailed testing
if 0
Npos = size(input,1);
prj = zeros(Npos, 3);
Expand Down
2 changes: 1 addition & 1 deletion utilities/ft_warp_optim.m
Expand Up @@ -61,7 +61,7 @@
%
% $Id$

% this can be used for printing detailled user feedback
% this can be used for printing detailed user feedback
fb = false;

if nargin<3
Expand Down

0 comments on commit 67d7913

Please sign in to comment.