diff --git a/components/DefaultLayout.tsx b/components/DefaultLayout.tsx index 4dfe3ab252..26f46627bc 100644 --- a/components/DefaultLayout.tsx +++ b/components/DefaultLayout.tsx @@ -8,6 +8,7 @@ import { SupportSection } from 'components/page-footer/SupportSection' import { DeprecationBanner } from 'components/page-header/DeprecationBanner' import { useMainContext } from 'components/context/MainContext' import { useTranslation } from 'components/hooks/useTranslation' +import { useRouter } from 'next/router' type Props = { children?: React.ReactNode } export const DefaultLayout = (props: Props) => { @@ -15,7 +16,6 @@ export const DefaultLayout = (props: Props) => { page, error, isHomepageVersion, - currentLanguage, currentPathWithoutLanguage, currentVersion, currentProduct, @@ -24,6 +24,7 @@ export const DefaultLayout = (props: Props) => { status, } = useMainContext() const { t } = useTranslation(['errors', 'scroll_button']) + const router = useRouter() return (
@@ -52,7 +53,7 @@ export const DefaultLayout = (props: Props) => { {page.topics.length > 0 && } {/* For analytics events */} - {currentLanguage && } + {router.locale && } {currentVersion && } {currentProduct && } {relativePath && ( diff --git a/components/context/MainContext.tsx b/components/context/MainContext.tsx index 17e8f2cbe9..51cd94fb49 100644 --- a/components/context/MainContext.tsx +++ b/components/context/MainContext.tsx @@ -77,7 +77,6 @@ export type MainContextT = { relativePath?: string enterpriseServerReleases: EnterpriseServerReleases currentPathWithoutLanguage: string - currentLanguage: string userLanguage: string allVersions: Record currentVersion?: string @@ -162,7 +161,6 @@ export const getMainContext = (req: any, res: any): MainContextT => { 'supported', ]), enterpriseServerVersions: req.context.enterpriseServerVersions, - currentLanguage: req.context.currentLanguage, userLanguage: req.context.userLanguage || '', allVersions: req.context.allVersions, currentVersion: req.context.currentVersion, diff --git a/components/page-header/HeaderNotifications.tsx b/components/page-header/HeaderNotifications.tsx index faed327ebb..f4eb792ccc 100644 --- a/components/page-header/HeaderNotifications.tsx +++ b/components/page-header/HeaderNotifications.tsx @@ -21,14 +21,8 @@ type Notif = { export const HeaderNotifications = () => { const router = useRouter() const { currentVersion } = useVersion() - const { - relativePath, - allVersions, - data, - currentLanguage, - userLanguage, - currentPathWithoutLanguage, - } = useMainContext() + const { relativePath, allVersions, data, userLanguage, currentPathWithoutLanguage } = + useMainContext() const { languages } = useLanguages() const { t } = useTranslation('header') @@ -39,12 +33,12 @@ export const HeaderNotifications = () => { type: NotificationType.TRANSLATION, content: data.reusables.policies.translation, }) - } else if (languages[currentLanguage].wip !== true) { + } else if (router.locale && languages[router.locale].wip !== true) { translationNotices.push({ type: NotificationType.TRANSLATION, content: t('notices.localization_complete'), }) - } else if (languages[currentLanguage].wip) { + } else if (router.locale && languages[router.locale].wip) { translationNotices.push({ type: NotificationType.TRANSLATION, content: t('notices.localization_in_progress'), diff --git a/components/release-notes/GHESReleaseNotes.tsx b/components/release-notes/GHESReleaseNotes.tsx index 1f49620ecc..438f0d4f56 100644 --- a/components/release-notes/GHESReleaseNotes.tsx +++ b/components/release-notes/GHESReleaseNotes.tsx @@ -8,6 +8,7 @@ import { } from '@primer/octicons-react' import { useMainContext } from 'components/context/MainContext' import dayjs from 'dayjs' +import { useRouter } from 'next/router' import { Link } from 'components/Link' import { MarkdownContent } from 'components/ui/MarkdownContent' @@ -18,7 +19,8 @@ type Props = { context: GHESReleaseNotesContextT } export function GHESReleaseNotes({ context }: Props) { - const { currentLanguage, currentProduct } = useMainContext() + const router = useRouter() + const { currentProduct } = useMainContext() const [focusedPatch, setFocusedPatch] = useState('') const { prevRelease, @@ -37,7 +39,7 @@ export function GHESReleaseNotes({ context }: Props) { {prevRelease ? ( {prevRelease} @@ -52,7 +54,7 @@ export function GHESReleaseNotes({ context }: Props) { {nextRelease ? ( {nextRelease} @@ -87,7 +89,7 @@ export function GHESReleaseNotes({ context }: Props) {
    {releases.map((release) => { - const releaseLink = `/${currentLanguage}/${currentVersion.plan}@${release.version}/${currentProduct?.id}/release-notes` + const releaseLink = `/${router.locale}/${currentVersion.plan}@${release.version}/${currentProduct?.id}/release-notes` if (!release.patches || release.patches.length === 0) { return ( diff --git a/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository.md b/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository.md index 6c08eee792..4b661e07f1 100644 --- a/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository.md +++ b/content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository.md @@ -109,6 +109,17 @@ You can filter the alerts shown in the {% data variables.product.prodname_code_s The benefit of using keyword filters is that only values with results are shown in the drop-down lists. This makes it easy to avoid setting filters that find no results. +### Restricting results to application code only + +You can use the "Only alerts in application code" filter or `autofilter:true` keyword and value to restrict results to alerts in application code. Application code excludes the following. + +- Code generated by the build process +- Test code +- Library or third-party code +- Documentation + +{% data variables.product.prodname_code_scanning_capc %} categorizes files by file path. At this time, you cannot manually categorize source files. + {% ifversion fpt or ghes > 3.1 %} ## Searching {% data variables.product.prodname_code_scanning %} alerts