diff --git a/.travis.yml b/.travis.yml index 235ce2a1..ca362514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,4 @@ before_script: - cd tests script: - - octave $OCTFLAGS --eval "results = runtests; assert(all(~[results.Failed]))" + - octave $OCTFLAGS --eval "results = runTests; assert(all(~[results.Failed]))" diff --git a/README.md b/README.md index 99b6b4fe..5cf60913 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ - [Contributing](#contributing) - [Guidestyle](#guidestyle) - [BIDS naming convention](#bids-naming-convention) + - [Contributors ✨](#contributors-) @@ -184,7 +185,8 @@ Feel free to open issues to report a bug and ask for improvements. ### Guidestyle - We use camelCase. -- We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/matlab_checkcode) below 15. +- We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) below 15. +- We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues. ### BIDS naming convention diff --git a/checkCFG.m b/checkCFG.m index c97834ce..59ea4d15 100644 --- a/checkCFG.m +++ b/checkCFG.m @@ -1,57 +1,56 @@ function [expParameters, cfg] = checkCFG(cfg, expParameters) -% check that we have all the fields that we need in the experiment -% parameters + % check that we have all the fields that we need in the experiment + % parameters -if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) - expParameters.verbose = 0; -end + if ~isfield(expParameters, 'verbose') || isempty(expParameters.verbose) + expParameters.verbose = 0; + end -if ~isfield(expParameters, 'outputDir') - expParameters.outputDir = fullfile(... - fileparts(mfilename('fullpath')), ... - '..', ... - 'output'); -end + if ~isfield(expParameters, 'outputDir') + expParameters.outputDir = fullfile( ... + fileparts(mfilename('fullpath')), ... + '..', ... + 'output'); + end -% set empty values for a series of field if they have not been specified -% 'ce' -% 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI -% 'rec' For BIDS file naming: reconstruction of fMRI images -% 'echo' For BIDS file naming: echo fMRI images -% 'acq' For BIDS file naming: acquisition of fMRI images -% 'subjectGrp' in case no group was provided -% 'sessionNb' in case no session was provided - -fields2Check = { ... - 'ce', ... - 'dir', ... - 'rec', ... - 'echo', ... - 'acq', ... - 'subjectGrp', ... - 'sessionNb'}; - -for iField = 1:numel(fields2Check) - if ~isfield(expParameters, fields2Check{iField}) - expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok + % set empty values for a series of field if they have not been specified + % 'ce' + % 'dir' For BIDS file naming: phase encoding direction of acquisition for fMRI + % 'rec' For BIDS file naming: reconstruction of fMRI images + % 'echo' For BIDS file naming: echo fMRI images + % 'acq' For BIDS file naming: acquisition of fMRI images + % 'subjectGrp' in case no group was provided + % 'sessionNb' in case no session was provided + + fields2Check = { ... + 'ce', ... + 'dir', ... + 'rec', ... + 'echo', ... + 'acq', ... + 'subjectGrp', ... + 'sessionNb'}; + + for iField = 1:numel(fields2Check) + if ~isfield(expParameters, fields2Check{iField}) + expParameters = setfield(expParameters, fields2Check{iField}, []); %#ok + end end -end -% set false value for a series of field if they have not been specified -fields2CheckFalse = { ... - 'eyeTracker' - }; + % set false value for a series of field if they have not been specified + fields2CheckFalse = { ... + 'eyeTracker' + }; -for iField = 1:numel(fields2CheckFalse) - if ~isfield(cfg, fields2CheckFalse{iField}) - cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok + for iField = 1:numel(fields2CheckFalse) + if ~isfield(cfg, fields2CheckFalse{iField}) + cfg = setfield(cfg, fields2CheckFalse{iField}, false); %#ok + end end -end - -% other defaults -if ~isfield(expParameters, 'askGrpSess') - expParameters.askGrpSess = [true true]; -end + % other defaults + if ~isfield(expParameters, 'askGrpSess') + expParameters.askGrpSess = [true true]; + end end diff --git a/createFilename.m b/createFilename.m index 0ef65a67..ba46389d 100644 --- a/createFilename.m +++ b/createFilename.m @@ -1,159 +1,153 @@ function expParameters = createFilename(cfg, expParameters) -% create the BIDS compliant directories and filenames for the behavioral output for this subject / -% session / run using the information from cfg and expParameters. -% Will also create the right filename for the eyetracking data file. -% -% For the moment the date of acquisition is appended to the filename -% -% can work for behavioral experiment if cfg.device is set to 'PC' -% can work for fMRI experiment if cfg.device is set to 'scanner' -% can work for simple eyetracking data if cfg.eyeTracker is set to 1 -% -% BOLD -% sub-