Skip to content

Commit

Permalink
Merge pull request OHDSI#258 from OHDSI/linted-achilles
Browse files Browse the repository at this point in the history
trying to use linters and fixing achilles
  • Loading branch information
fdefalco authored Oct 14, 2016
2 parents 21de543 + be64b3b commit dc5ccc1
Show file tree
Hide file tree
Showing 9 changed files with 2,128 additions and 2,056 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/web.config
122 changes: 122 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
// * set all relaxing options to false
// * set all environment options to false, except the browser value
// * set all JSLint legacy options to false
//
// [1]: http://www.jshint.com/
// [2]: https://github.com/jshint/node-jshint/blob/master/example/config.json
// [3]: https://github.com/oryband/dotfiles/blob/master/jshintrc
//
// @author http://michael.haschke.biz/
// @license http://unlicense.org/

// == Enforcing Options ===============================================
//
// These options tell JSHint to be more strict towards your code. Use
// them if you want to allow only a safe subset of JavaScript, very
// useful when your codebase is shared with a big number of developers
// with different skill levels.
"bitwise": true, // Prohibit bitwise operators (&, |, ^, etc.).
"curly": true, // Require {} for every new block or scope.
"eqeqeq": false, // Require triple equals i.e. `===`.
"forin": true, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty": true, // Prohibit use of empty blocks.
"nonew": true, // Prohibit use of constructors for side-effects.
"plusplus": false, // Prohibit use of `++` & `--`.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"undef": true, // Require all non-global variables be declared before they are used.
"strict": false, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.

// == Relaxing Options ================================================
//
// These options allow you to suppress certain types of warnings. Use
// them only if you are absolutely positive that you know what you are
// doing.

"asi": false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"boss": false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"debug": false, // Allow debugger statements e.g. browser breakpoints.
"eqnull": false, // Tolerate use of `== null`.
"evil": false, // Tolerate use of `eval`.
"expr": false, // Tolerate `ExpressionStatement` as Programs.
"funcscope": false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside.
"globalstrict": false, // Allow global "use strict" (also enables 'strict').
"iterator": false, // Allow usage of __iterator__ property.
"lastsemic": false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block.
"laxbreak": false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"laxcomma": false, // Suppress warnings about comma-first coding style.
"loopfunc": false, // Allow functions to be defined within loops.
"multistr": false, // Tolerate multi-line strings.
"onecase": false, // Tolerate switches with just one case.
"proto": false, // Tolerate __proto__ property. This property is deprecated.
"regexdash": false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl": true, // Tolerate script-targeted URLs.
"smarttabs": false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only.
"shadow": false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"sub": true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"supernew": false, // Tolerate `new function () { ... };` and `new Object;`.
"validthis": false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.

// == Environments ====================================================
//
// These options pre-define global variables that are exposed by
// popular JavaScript libraries and runtime environments—such as
// browser or node.js.
"esversion": 5,
"browser": true, // Standard browser globals e.g. `window`, `document`.
"couch": false, // Enable globals exposed by CouchDB.
"devel": false, // Allow development statements e.g. `console.log();`.
"dojo": false, // Enable globals exposed by Dojo Toolkit.
"jquery": false, // Enable globals exposed by jQuery JavaScript library.
"mootools": false, // Enable globals exposed by MooTools JavaScript framework.
"node": false, // Enable globals available when code is running inside of the NodeJS runtime environment.
"nonstandard": false, // Define non-standard but widely adopted globals such as escape and unescape.
"prototypejs": false, // Enable globals exposed by Prototype JavaScript framework.
"rhino": false, // Enable globals available when your code is running inside of the Rhino runtime environment.
"wsh": false, // Enable globals available when your code is running as a script for the Windows Script Host.

// == Formatting and Complexity =======================================
//
// Indentation and max length work to naturally keep files small,
// editable, and with limited complexity. The other options are a
// strict way to enforce these.

//"maxlen": 160, // Maximum line length, helps reduce cyclomatic complexity
//"indent": 2, // Specify indentation spacing
//"maxparams": 10, // Maximum number of formal parameters allowed per function
//"maxdepth": 4, // Maximum nested statement depth for a function
//"maxstatements": 33, // Maximum number of statements allowed per function
//"maxcomplexity": 15, // Maximum cyclomatic complexity of a function
// http://en.wikipedia.org/wiki/Cyclomatic_complexity

// == JSLint Legacy ===================================================
//
// These options are legacy from JSLint. Aside from bug fixes they will
// not be improved in any way and might be removed at any point.

"nomen": false, // Prohibit use of initial or trailing underbars in names.
"onevar": true, // Allow only one `var` statement per function.
"passfail": false, // Stop on first error.
"white": true, // Check against strict whitespace and indentation rules.

"maxerr": 100, // Maximum errors before stopping.
"predef": [ // Extra globals.
"require",
"define",
"escape"
]
}
11 changes: 4 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<meta name="description" content="">
<meta name="author" content="">

<link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="js/styles/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="js/styles/bootstrap.min.css">
Expand All @@ -20,7 +19,6 @@
<link rel="stylesheet" type="text/css" href="js/styles/atlas.css">
<link rel="stylesheet" type="text/css" href="js/styles/chart.css">
<link rel="stylesheet" type="text/css" href="js/styles/achilles.css">
<!-- cartoon.css, maybe others, loaded dynamically -->

<title data-bind="text: pageTitle">ATLAS</title>
<!--Adobe Edge Runtime-->
Expand All @@ -39,15 +37,14 @@
</div>
</div>

<!-- ko if: pageModel.currentView() != 'splash' -->
<div id="wrapperLeftMenu" style="display:none;" data-bind="visible:!pageModel.minibar();">
<div id="wrapperLeftMenu" style="display:none;" data-bind="visible: pageModel.currentView() != 'splash'">
<div id="wrapperLogo">
<a href="#/splash">ATLAS</a>
</div>

<div class="list-group">
<a class="list-group-item" href="#/home"><i class="fa fa-fw fa-home" aria-hidden="true"></i>&nbsp;Home</a>
<!-- <a class="list-group-item" href="#/datasources"><i class="fa fa-fw fa-database" aria-hidden="true"></i>&nbsp;Data Sources</a> -->
<a class="list-group-item" href="#/datasources"><i class="fa fa-fw fa-database" aria-hidden="true"></i>&nbsp;Data Sources</a>
<a class="list-group-item" href="#/search"><i class="fa fa-fw fa-search" aria-hidden="true"></i>&nbsp;Vocabulary</a>
<a class="list-group-item" href="#/conceptsets"><i class="fa fa-fw fa-shopping-cart" aria-hidden="true"></i>&nbsp;Concept Sets</a>
<a class="list-group-item" href="#/cohortdefinitions"><i class="fa fa-fw fa-users" aria-hidden="true"></i>&nbsp;Cohorts</a>
Expand All @@ -59,8 +56,8 @@
<a class="list-group-item" target="_blank" href="https://github.com/ohdsi/atlas/issues" aria-hidden="true"><i class="fa fa-fw fa-comment"></i>&nbsp;Feedback</a>
</div>
</div>
<!-- /ko -->
<div data-bind="if:currentView() != 'splash', css: { minibar: minibar() }" id="wrapperMainWindow">

<div data-bind="if:currentView() != 'splash'" id="wrapperMainWindow">
<div id="wrapperMainWindowContainer">
<!-- ko if: pageModel.currentView() != 'loading' -->

Expand Down
15 changes: 7 additions & 8 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
self.appInitializationFailed = ko.observable(false);
self.initPromises = [];
self.applicationStatus = ko.observable('initializing');
self.minibar = ko.observable(false);
self.searchTabMode = ko.observable('simple');
self.pendingSearch = ko.observable(false);
self.pageTitle = ko.pureComputed(function () {
Expand Down Expand Up @@ -193,7 +192,7 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
},
'/estimation/:cohortComparisonId:': function (cohortComparisonId) {
require(['cohort-comparison-manager', 'cohort-definition-browser', 'components/atlas.cohort-editor', 'cohort-comparison-print-friendly', 'cohort-comparison-r-code'], function () {
self.currentCohortComparisonId(cohortComparisonId)
self.currentCohortComparisonId(cohortComparisonId);
self.currentView('estimation');
});
},
Expand All @@ -204,13 +203,13 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
},
'/iranalysis/new': function(analysisId) {
require(['ir-manager'], function () {
self.selectedIRAnalysisId(null)
self.selectedIRAnalysisId(null);
self.currentView('iranalysis');
});
},
'/iranalysis/:analysisId': function(analysisId) {
require(['ir-manager'], function () {
self.selectedIRAnalysisId(+analysisId)
self.selectedIRAnalysisId(+analysisId);
self.currentView('iranalysis');
});
},
Expand All @@ -226,7 +225,7 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
self.currentView('sptest_smoking');
});
},
}
};
self.router = new Router(routes).configure(routerOptions);
self.router.init('/');
self.applicationStatus('running');
Expand All @@ -241,7 +240,7 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
$('#wrapperLeftMenu').fadeIn();
$('#wrapperMainWindow').fadeIn();
}, 10);
}
};
self.loadConcept = function (conceptId) {
self.currentView('loading');
var conceptPromise = $.ajax({
Expand Down Expand Up @@ -299,7 +298,7 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
$.when(conceptPromise).done(function () {
self.currentView('concept');
});
}
};
self.metagorize = function (metarchy, related) {
var concept = self.currentConcept();
var key = concept.VOCABULARY_ID + '.' + concept.CONCEPT_CLASS_ID;
Expand All @@ -312,7 +311,7 @@ define(['jquery', 'knockout', 'jnj_chart', 'd3', 'ohdsi.util', 'appConfig', 'fac
metarchy.parents.push(related);
}
}
}
};
self.searchConceptsOptions = {
Facets: [{
'caption': 'Vocabulary',
Expand Down
Loading

0 comments on commit dc5ccc1

Please sign in to comment.