diff --git a/dist/app/backend-elm.js b/dist/app/backend-elm.js index 6a249686..d9711055 100644 --- a/dist/app/backend-elm.js +++ b/dist/app/backend-elm.js @@ -15425,6 +15425,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) { return false; } }; +var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { + if (e.$ === 4) { + return true; + } else { + return false; + } +}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) { if (e.$ === 17) { return true; @@ -15441,6 +15448,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e }; var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( function (parts, context) { + var needsParentheses = function (e) { + return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e))); + }; return A2( $elm$core$Maybe$withDefault, context, @@ -15460,29 +15470,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( A2( $elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))), + A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))), A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))), - A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))), - A2( - $elm$core$Maybe$andThen, - $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, - $elm$core$List$head(parts)))))))); + $elm$core$Maybe$andThen, + $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, + $elm$core$List$head(parts)))))); }); var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2( function (caseBlock, context) { @@ -15519,13 +15511,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2( $elm$core$Tuple$first, A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs))); }); -var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { - if (e.$ === 4) { - return true; - } else { - return false; - } -}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) { if (e.$ === 15) { return true; diff --git a/dist/public/client-elm.js b/dist/public/client-elm.js index 5c644234..07195d9f 100644 --- a/dist/public/client-elm.js +++ b/dist/public/client-elm.js @@ -10996,6 +10996,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) { return false; } }; +var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { + if (e.$ === 4) { + return true; + } else { + return false; + } +}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) { if (e.$ === 17) { return true; @@ -11012,6 +11019,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e }; var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( function (parts, context) { + var needsParentheses = function (e) { + return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e))); + }; return A2( $elm$core$Maybe$withDefault, context, @@ -11031,29 +11041,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( A2( $elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))), + A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))), A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))), - A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))), - A2( - $elm$core$Maybe$andThen, - $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, - $elm$core$List$head(parts)))))))); + $elm$core$Maybe$andThen, + $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, + $elm$core$List$head(parts)))))); }); var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2( function (caseBlock, context) { @@ -11090,13 +11082,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2( $elm$core$Tuple$first, A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs))); }); -var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { - if (e.$ === 4) { - return true; - } else { - return false; - } -}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) { if (e.$ === 15) { return true; diff --git a/dist/public/editor-elm.js b/dist/public/editor-elm.js index b2b08124..6ce473e8 100644 --- a/dist/public/editor-elm.js +++ b/dist/public/editor-elm.js @@ -118,7 +118,7 @@ module.exports = function setup(port) { return module.exports; } /********** End of module 0: ./dist/app/editor/editor.js **********/ -/********** Start module 1: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/dist/app/editor/ws-client.js **********/ +/********** Start module 1: /extra/projects/misc/elm-analyse/dist/app/editor/ws-client.js **********/ __modules[1] = function(module, exports) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { @@ -188,8 +188,8 @@ exports.connect = connect; return module.exports; } -/********** End of module 1: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/dist/app/editor/ws-client.js **********/ -/********** Start module 2: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/dist/app/editor/elm.js **********/ +/********** End of module 1: /extra/projects/misc/elm-analyse/dist/app/editor/ws-client.js **********/ +/********** Start module 2: /extra/projects/misc/elm-analyse/dist/app/editor/elm.js **********/ __modules[2] = function(module, exports) { (function(scope){ 'use strict'; @@ -6446,6 +6446,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) { return false; } }; +var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { + if (e.$ === 'IfBlock') { + return true; + } else { + return false; + } +}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) { if (e.$ === 'LambdaExpression') { return true; @@ -6462,6 +6469,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e }; var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( function (parts, context) { + var needsParentheses = function (e) { + return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e))); + }; return A2( $elm$core$Maybe$withDefault, context, @@ -6481,29 +6491,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( A2( $elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))), + A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))), A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))), - A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))), - A2( - $elm$core$Maybe$andThen, - $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, - $elm$core$List$head(parts)))))))); + $elm$core$Maybe$andThen, + $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, + $elm$core$List$head(parts)))))); }); var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2( function (caseBlock, context) { @@ -6540,13 +6532,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2( $elm$core$Tuple$first, A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs))); }); -var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { - if (e.$ === 'IfBlock') { - return true; - } else { - return false; - } -}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) { if (e.$ === 'LetExpression') { return true; @@ -8980,8 +8965,8 @@ _Platform_export({'Editor':{'init':$author$project$Editor$main( A2($elm$json$Json$Decode$field, 'serverPort', $elm$json$Json$Decode$int)))(0)}});}(this)); return module.exports; } -/********** End of module 2: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/dist/app/editor/elm.js **********/ -/********** Start module 3: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/index.js **********/ +/********** End of module 2: /extra/projects/misc/elm-analyse/dist/app/editor/elm.js **********/ +/********** Start module 3: /extra/projects/misc/elm-analyse/node_modules/ws/index.js **********/ __modules[3] = function(module, exports) { /*! * ws: a node.js websocket client @@ -9001,8 +8986,8 @@ module.exports = WebSocket; return module.exports; } -/********** End of module 3: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/index.js **********/ -/********** Start module 4: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/WebSocket.js **********/ +/********** End of module 3: /extra/projects/misc/elm-analyse/node_modules/ws/index.js **********/ +/********** Start module 4: /extra/projects/misc/elm-analyse/node_modules/ws/lib/WebSocket.js **********/ __modules[4] = function(module, exports) { /*! * ws: a node.js websocket client @@ -9667,8 +9652,8 @@ function initAsClient (address, protocols, options) { return module.exports; } -/********** End of module 4: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/WebSocket.js **********/ -/********** Start module 5: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/WebSocketServer.js **********/ +/********** End of module 4: /extra/projects/misc/elm-analyse/node_modules/ws/lib/WebSocket.js **********/ +/********** Start module 5: /extra/projects/misc/elm-analyse/node_modules/ws/lib/WebSocketServer.js **********/ __modules[5] = function(module, exports) { /*! * ws: a node.js websocket client @@ -9985,8 +9970,8 @@ function abortConnection (socket, code, message) { return module.exports; } -/********** End of module 5: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/WebSocketServer.js **********/ -/********** Start module 6: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Receiver.js **********/ +/********** End of module 5: /extra/projects/misc/elm-analyse/node_modules/ws/lib/WebSocketServer.js **********/ +/********** Start module 6: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Receiver.js **********/ __modules[6] = function(module, exports) { /*! * ws: a node.js websocket client @@ -10539,8 +10524,8 @@ function toArrayBuffer (buf) { return module.exports; } -/********** End of module 6: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Receiver.js **********/ -/********** Start module 7: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Sender.js **********/ +/********** End of module 6: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Receiver.js **********/ +/********** Start module 7: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Sender.js **********/ __modules[7] = function(module, exports) { /*! * ws: a node.js websocket client @@ -10944,8 +10929,8 @@ function viewToBuffer (view) { return module.exports; } -/********** End of module 7: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Sender.js **********/ -/********** Start module 8: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/node_modules/ultron/index.js **********/ +/********** End of module 7: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Sender.js **********/ +/********** Start module 8: /extra/projects/misc/elm-analyse/node_modules/ws/node_modules/ultron/index.js **********/ __modules[8] = function(module, exports) { 'use strict'; @@ -11072,8 +11057,8 @@ module.exports = Ultron; return module.exports; } -/********** End of module 8: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/node_modules/ultron/index.js **********/ -/********** Start module 9: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/PerMessageDeflate.js **********/ +/********** End of module 8: /extra/projects/misc/elm-analyse/node_modules/ws/node_modules/ultron/index.js **********/ +/********** Start module 9: /extra/projects/misc/elm-analyse/node_modules/ws/lib/PerMessageDeflate.js **********/ __modules[9] = function(module, exports) { 'use strict'; @@ -11549,8 +11534,8 @@ function inflateOnError (err) { return module.exports; } -/********** End of module 9: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/PerMessageDeflate.js **********/ -/********** Start module 10: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/EventTarget.js **********/ +/********** End of module 9: /extra/projects/misc/elm-analyse/node_modules/ws/lib/PerMessageDeflate.js **********/ +/********** Start module 10: /extra/projects/misc/elm-analyse/node_modules/ws/lib/EventTarget.js **********/ __modules[10] = function(module, exports) { 'use strict'; @@ -11706,8 +11691,8 @@ module.exports = EventTarget; return module.exports; } -/********** End of module 10: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/EventTarget.js **********/ -/********** Start module 11: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Extensions.js **********/ +/********** End of module 10: /extra/projects/misc/elm-analyse/node_modules/ws/lib/EventTarget.js **********/ +/********** Start module 11: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Extensions.js **********/ __modules[11] = function(module, exports) { 'use strict'; @@ -11789,8 +11774,8 @@ module.exports = { format, parse }; return module.exports; } -/********** End of module 11: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Extensions.js **********/ -/********** Start module 12: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Constants.js **********/ +/********** End of module 11: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Extensions.js **********/ +/********** Start module 12: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Constants.js **********/ __modules[12] = function(module, exports) { 'use strict'; @@ -11805,8 +11790,8 @@ exports.NOOP = () => {}; return module.exports; } -/********** End of module 12: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Constants.js **********/ -/********** Start module 13: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/safe-buffer/index.js **********/ +/********** End of module 12: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Constants.js **********/ +/********** Start module 13: /extra/projects/misc/elm-analyse/node_modules/safe-buffer/index.js **********/ __modules[13] = function(module, exports) { /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') @@ -11868,8 +11853,8 @@ SafeBuffer.allocUnsafeSlow = function (size) { return module.exports; } -/********** End of module 13: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/safe-buffer/index.js **********/ -/********** Start module 14: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Validation.js **********/ +/********** End of module 13: /extra/projects/misc/elm-analyse/node_modules/safe-buffer/index.js **********/ +/********** Start module 14: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Validation.js **********/ __modules[14] = function(module, exports) { /*! * ws: a node.js websocket client @@ -11891,8 +11876,8 @@ try { return module.exports; } -/********** End of module 14: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/Validation.js **********/ -/********** Start module 15: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/BufferUtil.js **********/ +/********** End of module 14: /extra/projects/misc/elm-analyse/node_modules/ws/lib/Validation.js **********/ +/********** Start module 15: /extra/projects/misc/elm-analyse/node_modules/ws/lib/BufferUtil.js **********/ __modules[15] = function(module, exports) { /*! * ws: a node.js websocket client @@ -11967,8 +11952,8 @@ try { return module.exports; } -/********** End of module 15: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/BufferUtil.js **********/ -/********** Start module 16: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/ErrorCodes.js **********/ +/********** End of module 15: /extra/projects/misc/elm-analyse/node_modules/ws/lib/BufferUtil.js **********/ +/********** Start module 16: /extra/projects/misc/elm-analyse/node_modules/ws/lib/ErrorCodes.js **********/ __modules[16] = function(module, exports) { /*! * ws: a node.js websocket client @@ -12001,8 +11986,8 @@ module.exports = { return module.exports; } -/********** End of module 16: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/ws/lib/ErrorCodes.js **********/ -/********** Start module 17: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/async-limiter/index.js **********/ +/********** End of module 16: /extra/projects/misc/elm-analyse/node_modules/ws/lib/ErrorCodes.js **********/ +/********** Start module 17: /extra/projects/misc/elm-analyse/node_modules/async-limiter/index.js **********/ __modules[17] = function(module, exports) { 'use strict'; @@ -12074,8 +12059,8 @@ module.exports = Queue; return module.exports; } -/********** End of module 17: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/async-limiter/index.js **********/ -/********** Start module 18: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/utf-8-validate/index.js **********/ +/********** End of module 17: /extra/projects/misc/elm-analyse/node_modules/async-limiter/index.js **********/ +/********** Start module 18: /extra/projects/misc/elm-analyse/node_modules/utf-8-validate/index.js **********/ __modules[18] = function(module, exports) { 'use strict'; @@ -12087,8 +12072,8 @@ try { return module.exports; } -/********** End of module 18: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/utf-8-validate/index.js **********/ -/********** Start module 19: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bufferutil/index.js **********/ +/********** End of module 18: /extra/projects/misc/elm-analyse/node_modules/utf-8-validate/index.js **********/ +/********** Start module 19: /extra/projects/misc/elm-analyse/node_modules/bufferutil/index.js **********/ __modules[19] = function(module, exports) { 'use strict'; @@ -12100,8 +12085,8 @@ try { return module.exports; } -/********** End of module 19: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bufferutil/index.js **********/ -/********** Start module 20: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/node-gyp-build/index.js **********/ +/********** End of module 19: /extra/projects/misc/elm-analyse/node_modules/bufferutil/index.js **********/ +/********** Start module 20: /extra/projects/misc/elm-analyse/node_modules/node-gyp-build/index.js **********/ __modules[20] = function(module, exports) { var fs = require('fs') var path = require('path') @@ -12179,8 +12164,8 @@ function isElectron () { return module.exports; } -/********** End of module 20: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/node-gyp-build/index.js **********/ -/********** Start module 21: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/utf-8-validate/fallback.js **********/ +/********** End of module 20: /extra/projects/misc/elm-analyse/node_modules/node-gyp-build/index.js **********/ +/********** Start module 21: /extra/projects/misc/elm-analyse/node_modules/utf-8-validate/fallback.js **********/ __modules[21] = function(module, exports) { 'use strict'; @@ -12247,8 +12232,8 @@ module.exports = isValidUTF8; return module.exports; } -/********** End of module 21: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/utf-8-validate/fallback.js **********/ -/********** Start module 22: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bindings/bindings.js **********/ +/********** End of module 21: /extra/projects/misc/elm-analyse/node_modules/utf-8-validate/fallback.js **********/ +/********** Start module 22: /extra/projects/misc/elm-analyse/node_modules/bindings/bindings.js **********/ __modules[22] = function(module, exports) { /** @@ -12402,8 +12387,8 @@ exports.getRoot = function getRoot (file) { return module.exports; } -/********** End of module 22: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bindings/bindings.js **********/ -/********** Start module 23: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bufferutil/fallback.js **********/ +/********** End of module 22: /extra/projects/misc/elm-analyse/node_modules/bindings/bindings.js **********/ +/********** Start module 23: /extra/projects/misc/elm-analyse/node_modules/bufferutil/fallback.js **********/ __modules[23] = function(module, exports) { /*! * bufferutil: WebSocket buffer utils @@ -12447,7 +12432,7 @@ module.exports = { mask, unmask }; return module.exports; } -/********** End of module 23: /Users/matstijl/development/repositories/github/stil4m/elm-analyse/node_modules/bufferutil/fallback.js **********/ +/********** End of module 23: /extra/projects/misc/elm-analyse/node_modules/bufferutil/fallback.js **********/ /********** Footer **********/ if(typeof module === "object") module.exports = __require(0); diff --git a/docs/docs.js b/docs/docs.js index f0550227..c7d2b6ec 100644 --- a/docs/docs.js +++ b/docs/docs.js @@ -10745,6 +10745,13 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isCase = function (e) { return false; } }; +var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { + if (e.$ === 'IfBlock') { + return true; + } else { + return false; + } +}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda = function (e) { if (e.$ === 'LambdaExpression') { return true; @@ -10761,6 +10768,9 @@ var $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication = function (e }; var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( function (parts, context) { + var needsParentheses = function (e) { + return $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isCase(e) || ($stil4m$elm_syntax$Elm$Syntax$Expression$isLambda(e) || $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse(e))); + }; return A2( $elm$core$Maybe$withDefault, context, @@ -10780,29 +10790,11 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onApplication = F2( A2( $elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isLambda, $elm$core$Basics$not))), + A2($elm$core$Basics$composeR, needsParentheses, $elm$core$Basics$not))), A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isCase, $elm$core$Basics$not))), - A2( - $elm_community$maybe_extra$Maybe$Extra$filter, - A2( - $elm$core$Basics$composeR, - $elm$core$Tuple$second, - A2( - $elm$core$Basics$composeR, - $stil4m$elm_syntax$Elm$Syntax$Node$value, - A2($elm$core$Basics$composeR, $stil4m$elm_syntax$Elm$Syntax$Expression$isOperatorApplication, $elm$core$Basics$not))), - A2( - $elm$core$Maybe$andThen, - $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, - $elm$core$List$head(parts)))))))); + $elm$core$Maybe$andThen, + $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, + $elm$core$List$head(parts)))))); }); var $author$project$Analyser$Checks$UnnecessaryParens$onCaseBlock = F2( function (caseBlock, context) { @@ -10839,13 +10831,6 @@ var $author$project$Analyser$Checks$UnnecessaryParens$onListExpr = F2( $elm$core$Tuple$first, A2($elm$core$List$filterMap, $author$project$Analyser$Checks$UnnecessaryParens$getParenthesized, exprs))); }); -var $stil4m$elm_syntax$Elm$Syntax$Expression$isIfElse = function (e) { - if (e.$ === 'IfBlock') { - return true; - } else { - return false; - } -}; var $stil4m$elm_syntax$Elm$Syntax$Expression$isLet = function (e) { if (e.$ === 'LetExpression') { return true; diff --git a/package-lock.json b/package-lock.json index f03c9ee2..9160a1b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -853,6 +853,14 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "elm": { + "version": "0.19.1-3", + "resolved": "https://registry.npmjs.org/elm/-/elm-0.19.1-3.tgz", + "integrity": "sha512-6y36ewCcVmTOx8lj7cKJs3bhI5qMfoVEigePZ9PhEUNKpwjjML/pU2u2YSpHVAznuCcojoF6KIsrS1Ci7GtVaQ==", + "requires": { + "request": "^2.88.0" + } + }, "elm-format": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/elm-format/-/elm-format-0.8.0.tgz", diff --git a/package.json b/package.json index 55dc6daf..c123d93d 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ ], "dependencies": { "body-parser": "1.19.0", + "elm": "^0.19.1-3", "express": "4.17.1", "express-ws": "2.0.0", "find": "0.2.7", diff --git a/src/Analyser/Checks/UnnecessaryParens.elm b/src/Analyser/Checks/UnnecessaryParens.elm index a163585d..53aad21f 100644 --- a/src/Analyser/Checks/UnnecessaryParens.elm +++ b/src/Analyser/Checks/UnnecessaryParens.elm @@ -164,11 +164,17 @@ onIfBlock clause thenBranch elseBranch context = onApplication : List (Node Expression) -> Context -> Context onApplication parts context = + let + needsParentheses : Expression -> Bool + needsParentheses e = + Expression.isOperatorApplication e + || Expression.isCase e + || Expression.isLambda e + || Expression.isIfElse e + in List.head parts |> Maybe.andThen getParenthesized - |> Maybe.filter (Tuple.second >> Node.value >> Expression.isOperatorApplication >> not) - |> Maybe.filter (Tuple.second >> Node.value >> Expression.isCase >> not) - |> Maybe.filter (Tuple.second >> Node.value >> Expression.isLambda >> not) + |> Maybe.filter (Tuple.second >> Node.value >> needsParentheses >> not) |> Maybe.map Tuple.first |> Maybe.map (\a -> a :: context) |> Maybe.withDefault context