diff --git a/src/checkCFG.m b/src/checkCFG.m index a350f0e3..b6666647 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -12,7 +12,7 @@ %% list the defaults to set - fieldsToSet.verbose = false; + fieldsToSet.verbose = 0; fieldsToSet.useGUI = false; diff --git a/src/createFilename.m b/src/createFilename.m index 5a9a5da7..cf4e350f 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -201,7 +201,7 @@ function talkToMe(cfg) - if cfg.verbose + if cfg.verbose > 0 fprintf(1, '\nData will be saved in this directory:\n\t%s\n', ... fullfile(cfg.dir.outputSubject, cfg.fileName.modality)); diff --git a/src/miss_hit.cfg b/src/miss_hit.cfg index fce7fa45..25cb5611 100644 --- a/src/miss_hit.cfg +++ b/src/miss_hit.cfg @@ -1,3 +1,10 @@ +# style guide (https://florianschanda.github.io/miss_hit/style_checker.html) line_length: 100 regex_function_name: "[a-z]+(([A-Z]){1}[A-Za-z]+)*" -suppress_rule: "copyright_notice" \ No newline at end of file +suppress_rule: "copyright_notice" + +# metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html) +metric "cnest": limit 4 +metric "file_length": limit 500 +metric "cyc": limit 15 +metric "parameters": limit 6 \ No newline at end of file diff --git a/src/saveEventsFile.m b/src/saveEventsFile.m index eedcf905..949161ff 100644 --- a/src/saveEventsFile.m +++ b/src/saveEventsFile.m @@ -219,14 +219,14 @@ function printHeaderExtraColumns(logFile) warning('saveEventsFile:missingData', ... 'Missing some %s data for this event.', namesExtraColumns{iExtraColumn}); - if cfg.verbose + if cfg.verbose > 1 disp(logFile(iEvent)); end elseif ~ischar(data) && all(isnan(data)) warning('Missing %s data for this event.', namesExtraColumns{iExtraColumn}); - if cfg.verbose + if cfg.verbose > 1 disp(logFile(iEvent)); end end @@ -297,11 +297,11 @@ function printHeaderExtraColumns(logFile) else - printData(logFile(1).fileID, onset); - printData(logFile(1).fileID, duration); - printData(logFile(1).fileID, trial_type); + printData(logFile(1).fileID, onset, cfg); + printData(logFile(1).fileID, duration, cfg); + printData(logFile(1).fileID, trial_type, cfg); - printExtraColumns(logFile, iEvent); + printExtraColumns(logFile, iEvent, cfg); fprintf(logFile(1).fileID, '\n'); fprintf(1, '\n'); @@ -311,7 +311,7 @@ function printHeaderExtraColumns(logFile) end -function printExtraColumns(logFile, iEvent) +function printExtraColumns(logFile, iEvent, cfg) % loops through the extra columns and print them namesExtraColumns = returnNamesExtraColumns(logFile); @@ -320,26 +320,32 @@ function printExtraColumns(logFile, iEvent) data = logFile(iEvent).(namesExtraColumns{iExtraColumn}); - printData(logFile(1).fileID, data); + printData(logFile(1).fileID, data, cfg); end end -function printData(output, data) +function printData(output, data, cfg) % write char % for numeric data we replace any nan by n/a if ischar(data) fprintf(output, '%s\t', data); - fprintf(1, '%s\t', data); + if cfg.verbose > 0 + fprintf(1, '%s\t', data); + end else for i = 1:numel(data) if isnan(data(i)) fprintf(output, '%s\t', 'n/a'); - fprintf(1, '%s\t', 'n/a'); + if cfg.verbose > 0 + fprintf(1, '%s\t', 'n/a'); + end else fprintf(output, '%f\t', data(i)); - fprintf(1, '%f\t', data(i)); + if cfg.verbose > 0 + fprintf(1, '%f\t', data(i)); + end end end end @@ -384,7 +390,7 @@ function errorSaveEventsFile(identifier) function talkToMe(cfg, logFile) - if cfg.verbose + if cfg.verbose > 0 fprintf(1, '\nData were saved in this file:\n\n%s\n\n', ... fullfile( ... diff --git a/src/subfun/printCreditsCppBids.m b/src/subfun/printCreditsCppBids.m index 5a6f2c95..e9ff763a 100644 --- a/src/subfun/printCreditsCppBids.m +++ b/src/subfun/printCreditsCppBids.m @@ -7,19 +7,19 @@ function printCreditsCppBids(cfg) version = 'v1.0.0'; end - verbose = true; + verbose = 2; if ~isempty(cfg) && isfield(cfg, 'verbose') && ~isempty(cfg.verbose) verbose = cfg.verbose; end - if verbose + if verbose > 1 contributors = { ... 'Rémi Gau', ... 'Marco Barilari', ... 'Ceren Battal'}; - % DOI_URL = 'https://doi.org/10.5281/zenodo.3554331.'; + DOI_URL = 'https://doi.org/10.5281/zenodo.4007674'; repoURL = 'https://github.com/cpp-lln-lab/CPP_BIDS'; @@ -44,7 +44,7 @@ function printCreditsCppBids(cfg) end fprintf('\b\n\n'); - % fprintf('Please cite using the following DOI: \n %s\n\n', DOI_URL) + fprintf('Please cite using the following DOI: \n %s\n\n', DOI_URL); fprintf('For bug report, suggestions or contributions see: \n %s\n\n', repoURL); diff --git a/tests/test_checkCFG.m b/tests/test_checkCFG.m index 5deb56c4..94ec3e34 100644 --- a/tests/test_checkCFG.m +++ b/tests/test_checkCFG.m @@ -29,7 +29,7 @@ function test_checkCfgBasic() %% set up outputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'output'); - cfg.verbose = false; + cfg.verbose = 0; cfg.subject.subjectNb = 1; cfg.subject.runNb = 1;