-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1442 from benedikt-richter/warn_for_magic_numbers
Disallow magic numbers
- Loading branch information
Showing
36 changed files
with
168 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// SPDX-FileCopyrightText: Nico Carl <[email protected]> | ||
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates | ||
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
@@ -83,7 +85,11 @@ export function PackageSearchPopup(): ReactElement { | |
const [currentSearchTerm, setCurrentSearchTerm] = useState<string>( | ||
getInitialSearchTerm(temporaryPackageInfo) | ||
); | ||
const debouncedSearchTerm = useDebounceInput(currentSearchTerm, 500); | ||
const debounceDelayInMs = 500; | ||
const debouncedSearchTerm = useDebounceInput( | ||
currentSearchTerm, | ||
debounceDelayInMs | ||
); | ||
const { isLoading, data, isError, error } = useQuery( | ||
['clearlyDefinedPackageSearch', debouncedSearchTerm], | ||
() => searchPackagesOnClearlyDefined(debouncedSearchTerm), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// SPDX-FileCopyrightText: Nico Carl <[email protected]> | ||
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates | ||
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
@@ -23,9 +25,11 @@ describe('ClearlyDefinedPackageCard', () => { | |
}); | ||
const testCoordinate = 'sqlalchemy'; | ||
const definitionEndpoint = `https://api.clearlydefined.io/definitions/${testCoordinate}`; | ||
const okStatus = 200; | ||
const notFoundStatus = 404; | ||
|
||
it('renders after successful fetch', async () => { | ||
axiosMock.onGet(definitionEndpoint).replyOnce(200, { | ||
axiosMock.onGet(definitionEndpoint).replyOnce(okStatus, { | ||
licensed: { | ||
declared: 'MIT', | ||
facets: { | ||
|
@@ -82,7 +86,7 @@ describe('ClearlyDefinedPackageCard', () => { | |
it('shows error message when fetch fails', async () => { | ||
// suppress output to console | ||
jest.spyOn(console, 'error').mockImplementation(() => {}); | ||
axiosMock.onGet(definitionEndpoint).replyOnce(404); | ||
axiosMock.onGet(definitionEndpoint).replyOnce(notFoundStatus); | ||
|
||
renderComponentWithStore( | ||
<QueryClientProvider client={queryClient}> | ||
|
Oops, something went wrong.