Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoenmaeckers committed Nov 27, 2024
1 parent 470a41c commit d40a1f9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
50 changes: 20 additions & 30 deletions lib/modules/manager/pep621/processors/uv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,13 @@ describe('modules/manager/pep621/processors/uv', () => {
},
{
depName: 'dep3',
registryUrls: [
'https://baz.com/simple',
'https://pypi.org/pypi/'
],
registryUrls: ['https://baz.com/simple', 'https://pypi.org/pypi/'],
packageName: 'dep3',
},
]);
});


it('override implicit default index', () => {
it('override implicit default index', () => {
const pyproject = {
tool: {
uv: {
Expand Down Expand Up @@ -256,22 +252,18 @@ it('override implicit default index', () => {
expect(result).toEqual([
{
depName: 'dep1',
registryUrls: [
'https://foo.com/simple',
],
registryUrls: ['https://foo.com/simple'],
packageName: 'dep1',
},
{
depName: 'dep2',
registryUrls: [
'https://foo.com/simple',
],
registryUrls: ['https://foo.com/simple'],
packageName: 'dep2',
},
]);
});

it('override explicit default index', () => {
it('override explicit default index', () => {
const pyproject = {
tool: {
uv: {
Expand Down Expand Up @@ -307,9 +299,7 @@ it('override explicit default index', () => {
{
depName: 'dep1',
depType: depTypes.uvSources,
registryUrls: [
'https://foo.com/simple',
],
registryUrls: ['https://foo.com/simple'],
packageName: 'dep1',
},
{
Expand Down Expand Up @@ -532,9 +522,7 @@ it('override explicit default index', () => {
packageName: 'dep6',
depType: depTypes.dependencies,
datasource: PypiDatasource.id,
registryUrls: [
'https://pinned.com/simple',
],
registryUrls: ['https://pinned.com/simple'],
},
];
const result = await processor.updateArtifacts(
Expand All @@ -548,16 +536,18 @@ it('override explicit default index', () => {
tool: {
uv: {
sources: {
dep6: {index : 'pinned-index'},
dep6: { index: 'pinned-index' },
},
index: [{
name: 'pinned-index',
url: 'https://pinned.com/simple',
default: false,
explicit: true,
}]
}
}
index: [
{
name: 'pinned-index',
url: 'https://pinned.com/simple',
default: false,
explicit: true,
},
],
},
},
},
);
expect(result).toEqual([
Expand All @@ -583,8 +573,8 @@ it('override explicit default index', () => {
GIT_CONFIG_VALUE_2: 'https://example.com/',
UV_EXTRA_INDEX_URL:
'https://foobar.com/ https://user:[email protected]/ https://oauth2accesstoken:[email protected]/some-project/some-repo/',
UV_INDEX_PINNED_INDEX_USERNAME: "user",
UV_INDEX_PINNED_INDEX_PASSWORD: "pass",
UV_INDEX_PINNED_INDEX_USERNAME: 'user',
UV_INDEX_PINNED_INDEX_PASSWORD: 'pass',
},
},
},
Expand Down
10 changes: 7 additions & 3 deletions lib/modules/manager/pep621/processors/uv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export class UvProcessor implements PyProjectProcessor {
return deps;
}

const hasExplicitDefault = uv.index?.some((index) => index.default && index.explicit);
const defaultIndex = uv.index?.find((index) => index.default && !index.explicit);
const hasExplicitDefault = uv.index?.some(
(index) => index.default && index.explicit,
);
const defaultIndex = uv.index?.find(
(index) => index.default && !index.explicit,
);
const implicitIndexes = uv.index
?.filter((index) => !index.explicit && index.name !== defaultIndex?.name)
?.map(({ url }) => url);
Expand Down Expand Up @@ -99,7 +103,7 @@ export class UvProcessor implements PyProjectProcessor {
// If there are implicit indexes, check them first and fall back
// to the default.
dep.registryUrls = implicitIndexes.concat(
dep.registryUrls ?? 'https://pypi.org/pypi/'
dep.registryUrls ?? 'https://pypi.org/pypi/',
);
}
}
Expand Down

0 comments on commit d40a1f9

Please sign in to comment.