Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dc/.juspay/dc/test/IgnorePath/IgnoreModule.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ignoredFun": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 22,
"src_span_endl": 6,
"src_span_name": "test/IgnorePath/IgnoreModule.hs",
"src_span_startC": 14,
"src_span_startl": 6
}
]
}
10 changes: 10 additions & 0 deletions dc/.juspay/dc/test/IgnorePath/IgnoreModule.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [
"ignoredFun"
],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
1 change: 1 addition & 0 deletions dc/.juspay/dc/test/Main.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 10 additions & 0 deletions dc/.juspay/dc/test/Main.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [
"testParentFunction"
],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
26 changes: 26 additions & 0 deletions dc/.juspay/dc/test/PathsToConsider/Considered.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"consideredFun": [
{
"error_message": "Should not use exception functions for sync in default cases(\"consideredFun'\",[\"consideredFun'\"])",
"module_name": "",
"package_name": "",
"src_span_endC": 31,
"src_span_endl": 7,
"src_span_name": "test/PathsToConsider/Considered.hs",
"src_span_startC": 17,
"src_span_startl": 7
}
],
"consideredFunOutsideErr": [
{
"error_message": "Should not use exception functions for sync in default cases(\"simpleReturn\",[\"tempThrowErr\",\"whereClauseCaseLeftErr\",\"whereClauseErr\",\"rightCaseError\",\"leftCaseError\",\"whereClauseCaseRightErr\",\"simpleReturn\",\"ignoredErr\"])",
"module_name": "",
"package_name": "",
"src_span_endC": 39,
"src_span_endl": 10,
"src_span_name": "test/PathsToConsider/Considered.hs",
"src_span_startC": 27,
"src_span_startl": 10
}
]
}
11 changes: 11 additions & 0 deletions dc/.juspay/dc/test/PathsToConsider/Considered.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [
"consideredFunOutsideErr",
"consideredFun"
],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
14 changes: 14 additions & 0 deletions dc/.juspay/dc/test/PathsToConsider/ConsideredTests.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"consideredFun'": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 26,
"src_span_endl": 6,
"src_span_name": "test/PathsToConsider/ConsideredTests.hs",
"src_span_startC": 18,
"src_span_startl": 6
}
]
}
10 changes: 10 additions & 0 deletions dc/.juspay/dc/test/PathsToConsider/ConsideredTests.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [
"consideredFun'"
],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
1 change: 1 addition & 0 deletions dc/.juspay/dc/test/RestrictedFuncs.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
8 changes: 8 additions & 0 deletions dc/.juspay/dc/test/RestrictedFuncs.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
174 changes: 174 additions & 0 deletions dc/.juspay/dc/test/TestCases.hs.err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"ignoredErr": [
{
"error_message": "Should not use exception functions for sync in default cases(\"ignoredFun\",[\"ignoredFun\"])",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 9,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 14,
"src_span_startl": 9
}
],
"indirectLeftCaseError": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 25,
"src_span_endl": 37,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 25,
"src_span_startl": 35
},
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 27,
"src_span_endl": 36,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 15,
"src_span_startl": 36
}
],
"indirectRightCaseError": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 28,
"src_span_endl": 42,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 26,
"src_span_startl": 40
},
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 28,
"src_span_endl": 42,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 42
}
],
"indirectSimpleReturn": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 36,
"src_span_endl": 32,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 24,
"src_span_startl": 32
}
],
"leftCaseError": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 25,
"src_span_endl": 24,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 17,
"src_span_startl": 22
},
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 23,
"src_span_endl": 23,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 15,
"src_span_startl": 23
}
],
"rightCaseError": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 29,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 18,
"src_span_startl": 27
},
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 29,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 29
}
],
"simpleReturn": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 12,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 12
}
],
"tempThrowErr": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 58,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 58
}
],
"whereClauseCaseLeftErr": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 55,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 55
}
],
"whereClauseCaseRightErr": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 19,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 19
}
],
"whereClauseErr": [
{
"error_message": "Should not use exception functions for sync in default cases",
"module_name": "",
"package_name": "",
"src_span_endC": 24,
"src_span_endl": 48,
"src_span_name": "test/TestCases.hs",
"src_span_startC": 16,
"src_span_startl": 48
}
]
}
17 changes: 17 additions & 0 deletions dc/.juspay/dc/test/TestCases.hs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"allFailuresRecords": [],
"commonErrorFuns": [
"tempThrowErr",
"whereClauseCaseLeftErr",
"whereClauseErr",
"rightCaseError",
"leftCaseError",
"whereClauseCaseRightErr",
"simpleReturn",
"ignoredErr"
],
"createdFailures": [],
"createdRecords": [],
"updatedFailures": [],
"updatedRecords": []
}
11 changes: 11 additions & 0 deletions dc/.juspay/domainConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tag: FunctionCheck
contents:
listOfRestrictedFuns:
- "throwErr"
- "throwException"
moduleNameToCheck: "Main"
funNameToCheck: "testParentFunction"
conditionToCheck: []
pathsToConsider: []
pathsToIgnore: []
modulesToIgnore: []
15 changes: 13 additions & 2 deletions dc/dc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ library
-- Directories containing source files.
hs-source-dirs: src

other-modules:
DC.Constants
DC.Types

-- Base language which the package is written in.
default-language: Haskell2010

Expand All @@ -84,7 +88,7 @@ test-suite dc-test
-- Base language which the package is written in.
default-language: Haskell2010

ghc-options: -fplugin=DC.DefaultCheck
ghc-options: -fplugin=DC.DefaultCheck -fplugin-opt=DC.DefaultCheck:{"prefixPath":"./.juspay/dc/","pathsTobeChecked":["test/"]}
-- Modules included in this executable, other than Main.
-- other-modules:

Expand All @@ -97,10 +101,17 @@ test-suite dc-test
-- Directories containing source files.
hs-source-dirs: test

other-modules:
TestCases
RestrictedFuncs
IgnorePath.IgnoreModule
PathsToConsider.Considered
PathsToConsider.ConsideredTests

-- The entrypoint to the test suite.
main-is: Main.hs

-- Test dependencies.
build-depends:
base ^>=4.16.4.0,
base,
dc
5 changes: 3 additions & 2 deletions dc/src/DC/Constants.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ defaultCase = "Should not use status as success or failure in default case"
syncError :: String
syncError = "Should not use exception functions for sync in default cases"

prefixPath :: String
prefixPath = "./.juspay/dc/"
-- taking this from plugin options now
-- prefixPath ::
-- prefixPath = "./.juspay/dc/test/"
Loading