From ab05c1e46caa7260ff248ae41c969863ca3e516d Mon Sep 17 00:00:00 2001 From: Jessica Black Date: Wed, 1 May 2024 14:03:18 -0700 Subject: [PATCH] Revert the required newline before `.:` across the codebase --- src/App/Fossa/Lernie/Types.hs | 6 +- src/App/Fossa/ManualDeps.hs | 12 +- src/App/Types.hs | 6 +- .../FossaApiClient/Internal/FossaAPIV1.hs | 6 +- src/Effect/Exec.hs | 6 +- src/Fossa/API/Types.hs | 153 ++++++------------ src/Strategy/Conda/CondaEnvCreate.hs | 3 +- 7 files changed, 58 insertions(+), 134 deletions(-) diff --git a/src/App/Fossa/Lernie/Types.hs b/src/App/Fossa/Lernie/Types.hs index 1744087ee3..bf0dfea461 100644 --- a/src/App/Fossa/Lernie/Types.hs +++ b/src/App/Fossa/Lernie/Types.hs @@ -66,10 +66,8 @@ instance ToJSON GrepEntry where instance FromJSON GrepEntry where parseJSON = withObject "GrepEntry" $ \obj -> GrepEntry - <$> obj - .: "matchCriteria" - <*> obj - .: "name" + <$> obj .: "matchCriteria" + <*> obj .: "name" data LernieConfig = LernieConfig { rootDir :: Path Abs Dir diff --git a/src/App/Fossa/ManualDeps.hs b/src/App/Fossa/ManualDeps.hs index 20ed6d9c99..3479b519f5 100644 --- a/src/App/Fossa/ManualDeps.hs +++ b/src/App/Fossa/ManualDeps.hs @@ -513,8 +513,7 @@ instance FromJSON CustomDependency where <$> (obj `neText` "name") <*> (unTextLike <$> obj `neText` "version") <*> (obj `neText` "license") - <*> obj - .:? "metadata" + <*> obj .:? "metadata" <* forbidMembers "custom dependencies" ["type", "path", "url"] obj instance FromJSON RemoteDependency where @@ -523,8 +522,7 @@ instance FromJSON RemoteDependency where <$> (obj `neText` "name") <*> (unTextLike <$> obj `neText` "version") <*> (obj `neText` "url") - <*> obj - .:? "metadata" + <*> obj .:? "metadata" <* forbidMembers "remote dependencies" ["license", "path", "type"] obj validateRemoteDep :: (Has Diagnostics sig m) => RemoteDependency -> Organization -> m RemoteDependency @@ -582,10 +580,8 @@ instance ToDiagnostic RemoteDepLengthIsGtThanAllowed where instance FromJSON DependencyMetadata where parseJSON = withObject "metadata" $ \obj -> DependencyMetadata - <$> obj - .:? "description" - <*> obj - .:? "homepage" + <$> obj .:? "description" + <*> obj .:? "homepage" <* forbidMembers "metadata" ["url"] obj -- Parse supported dependency types into their respective type or return Nothing. diff --git a/src/App/Types.hs b/src/App/Types.hs index bc73551490..4c13fcc955 100644 --- a/src/App/Types.hs +++ b/src/App/Types.hs @@ -74,10 +74,8 @@ instance ToJSON ReleaseGroupMetadata where instance FromJSON ReleaseGroupMetadata where parseJSON = withObject "ReleaseGroupMetadata" $ \obj -> ReleaseGroupMetadata - <$> obj - .: "name" - <*> obj - .: "release" + <$> obj .: "name" + <*> obj .: "release" data ProjectRevision = ProjectRevision { projectName :: Text diff --git a/src/Control/Carrier/FossaApiClient/Internal/FossaAPIV1.hs b/src/Control/Carrier/FossaApiClient/Internal/FossaAPIV1.hs index 862f937da6..574482748a 100644 --- a/src/Control/Carrier/FossaApiClient/Internal/FossaAPIV1.hs +++ b/src/Control/Carrier/FossaApiClient/Internal/FossaAPIV1.hs @@ -240,10 +240,8 @@ data FossaPublicFacingError = FossaPublicFacingError instance FromJSON FossaPublicFacingError where parseJSON = withObject "FossaPublicFacingError" $ \v -> FossaPublicFacingError - <$> v - .: "message" - <*> v - .: "uuid" + <$> v .: "message" + <*> v .: "uuid" newtype FossaReq m a = FossaReq {unFossaReq :: m a} deriving (Functor, Applicative, Monad, Algebra sig) diff --git a/src/Effect/Exec.hs b/src/Effect/Exec.hs index 7d4958bb57..b7baa1ff08 100644 --- a/src/Effect/Exec.hs +++ b/src/Effect/Exec.hs @@ -139,10 +139,8 @@ instance RecordableValue CmdFailure instance FromJSON CmdFailure where parseJSON = withObject "CmdFailure" $ \obj -> CmdFailure - <$> obj - .: "cmdFailureCmd" - <*> obj - .: "cmdFailureDir" + <$> obj .: "cmdFailureCmd" + <*> obj .: "cmdFailureDir" <*> (obj .: "cmdFailureExit" >>= fromRecordedValue) <*> (obj .: "cmdFailureStdout" >>= fromRecordedValue) <*> (obj .: "cmdFailureStderr" >>= fromRecordedValue) diff --git a/src/Fossa/API/Types.hs b/src/Fossa/API/Types.hs index 01cf30b5f4..451090ce58 100644 --- a/src/Fossa/API/Types.hs +++ b/src/Fossa/API/Types.hs @@ -191,12 +191,9 @@ newtype BuildTask = BuildTask instance FromJSON Build where parseJSON = withObject "Build" $ \obj -> Build - <$> obj - .: "id" - <*> obj - .:? "error" - <*> obj - .: "task" + <$> obj .: "id" + <*> obj .:? "error" + <*> obj .: "task" instance FromJSON BuildTask where parseJSON = withObject "BuildTask" $ \obj -> @@ -331,15 +328,10 @@ newtype IssueRule = IssueRule instance FromJSON Issues where parseJSON = withObject "Issues" $ \obj -> Issues - <$> obj - .: "count" - <*> obj - .:? "issues" - .!= [] - <*> obj - .: "status" - <*> obj - .:? "summary" + <$> obj .: "count" + <*> obj .:? "issues" .!= [] + <*> obj .: "status" + <*> obj .:? "summary" instance ToJSON Issues where toJSON Issues{..} = @@ -353,11 +345,8 @@ instance ToJSON Issues where instance FromJSON IssuesSummary where parseJSON = withObject "IssuesSummary" $ \obj -> IssuesSummary - <$> obj - .: "revision" - <*> obj - .:? "targets" - .!= [] + <$> obj .: "revision" + <*> obj .:? "targets" .!= [] instance ToJSON IssuesSummary where toJSON IssuesSummary{..} = @@ -369,12 +358,9 @@ instance ToJSON IssuesSummary where instance FromJSON IssueSummaryRevision where parseJSON = withObject "IssueSummaryRevision" $ \obj -> IssueSummaryRevision - <$> obj - .: "projectTitle" - <*> obj - .: "projectRevision" - <*> obj - .:? "isPublic" + <$> obj .: "projectTitle" + <*> obj .: "projectRevision" + <*> obj .:? "isPublic" instance ToJSON IssueSummaryRevision where toJSON IssueSummaryRevision{..} = @@ -387,10 +373,8 @@ instance ToJSON IssueSummaryRevision where instance FromJSON IssueSummaryTarget where parseJSON = withObject "IssueSummaryTarget" $ \obj -> IssueSummaryTarget - <$> obj - .: "type" - <*> obj - .: "originPaths" + <$> obj .: "type" + <*> obj .: "originPaths" instance ToJSON IssueSummaryTarget where toJSON IssueSummaryTarget{..} = @@ -402,27 +386,16 @@ instance ToJSON IssueSummaryTarget where instance FromJSON Issue where parseJSON = withObject "Issue" $ \obj -> Issue - <$> obj - .: "id" - <*> obj - .:? "priorityString" - <*> obj - .: "resolved" - <*> obj - .:? "revisionId" - .!= "unknown project" - <*> obj - .: "type" - <*> obj - .:? "rule" - <*> obj - .:? "license" - <*> obj - .:? "issueDashURL" - <*> obj - .:? "cve" - <*> obj - .:? "fixedIn" + <$> obj .: "id" + <*> obj .:? "priorityString" + <*> obj .: "resolved" + <*> obj .:? "revisionId" .!= "unknown project" + <*> obj .: "type" + <*> obj .:? "rule" + <*> obj .:? "license" + <*> obj .:? "issueDashURL" + <*> obj .:? "cve" + <*> obj .:? "fixedIn" instance ToJSON Issue where toJSON Issue{..} = @@ -530,53 +503,22 @@ blankOrganization = instance FromJSON Organization where parseJSON = withObject "Organization" $ \obj -> Organization - <$> obj - .: "organizationId" - <*> obj - .:? "usesSAML" - .!= False - <*> obj - .:? "supportsCliLicenseScanning" - .!= False - <*> obj - .:? "supportsAnalyzedRevisionsQuery" - .!= False - <*> obj - .:? "defaultVendoredDependencyScanType" - .!= CLILicenseScan - <*> obj - .:? "supportsIssueDiffs" - .!= False - <*> obj - .:? "supportsNativeContainerScans" - .!= False - <*> obj - .:? "supportsDependenciesCachePolling" - .!= False - <*> obj - .:? "requireFullFileUploads" - .!= False - <*> obj - .:? "defaultToFirstPartyScans" - .!= False - <*> obj - .:? "supportsPathDependency" - .!= False - <*> obj - .:? "supportsFirstPartyScans" - .!= False - <*> obj - .:? "customLicenseScanConfigs" - .!= [] - <*> obj - .:? "supportsReachability" - .!= False - <*> obj - .:? "supportsPreflightChecks" - .!= False - <*> obj - .:? "subscription" - .!= Free + <$> obj .: "organizationId" + <*> obj .:? "usesSAML" .!= False + <*> obj .:? "supportsCliLicenseScanning" .!= False + <*> obj .:? "supportsAnalyzedRevisionsQuery" .!= False + <*> obj .:? "defaultVendoredDependencyScanType" .!= CLILicenseScan + <*> obj .:? "supportsIssueDiffs" .!= False + <*> obj .:? "supportsNativeContainerScans" .!= False + <*> obj .:? "supportsDependenciesCachePolling" .!= False + <*> obj .:? "requireFullFileUploads" .!= False + <*> obj .:? "defaultToFirstPartyScans" .!= False + <*> obj .:? "supportsPathDependency" .!= False + <*> obj .:? "supportsFirstPartyScans" .!= False + <*> obj .:? "customLicenseScanConfigs" .!= [] + <*> obj .:? "supportsReachability" .!= False + <*> obj .:? "supportsPreflightChecks" .!= False + <*> obj .:? "subscription" .!= Free data TokenType = Push @@ -589,8 +531,7 @@ newtype TokenTypeResponse = TokenTypeResponse {tokenType :: TokenType} instance FromJSON TokenTypeResponse where parseJSON = withObject "TokenTypeResponse" $ \obj -> TokenTypeResponse - <$> obj - .: "tokenType" + <$> obj .: "tokenType" instance FromJSON TokenType where parseJSON = withText "TokenType" $ \case @@ -651,12 +592,9 @@ data Project = Project instance FromJSON Project where parseJSON = withObject "Project" $ \obj -> Project - <$> obj - .: "id" - <*> obj - .: "title" - <*> obj - .: "isMonorepo" + <$> obj .: "id" + <*> obj .: "title" + <*> obj .: "isMonorepo" data UploadResponse = UploadResponse { uploadLocator :: Locator @@ -684,8 +622,7 @@ newtype RevisionDependencyCache = RevisionDependencyCache {status :: RevisionDep instance FromJSON RevisionDependencyCache where parseJSON = withObject "RevisionDependencyCache" $ \obj -> RevisionDependencyCache - <$> obj - .: "status" + <$> obj .: "status" instance FromJSON RevisionDependencyCacheStatus where parseJSON = withText "RevisionDependencyCacheStatus" $ \txt -> case Text.toUpper txt of diff --git a/src/Strategy/Conda/CondaEnvCreate.hs b/src/Strategy/Conda/CondaEnvCreate.hs index 17ab28f388..5cc5f085a7 100644 --- a/src/Strategy/Conda/CondaEnvCreate.hs +++ b/src/Strategy/Conda/CondaEnvCreate.hs @@ -94,8 +94,7 @@ data CondaEnvDep = CondaEnvDep instance FromJSON CondaEnvCreateOut where parseJSON = withObject "CondaEnvOutput" $ \obj -> CondaEnvCreateOut - <$> obj - .: "dependencies" + <$> obj .: "dependencies" type Parser = Parsec Void Text