Skip to content

Issue2/environment variables#14

Open
mickey4653 wants to merge 6 commits into
vibing-ai:mainfrom
mickey4653:issue2/environment-variables
Open

Issue2/environment variables#14
mickey4653 wants to merge 6 commits into
vibing-ai:mainfrom
mickey4653:issue2/environment-variables

Conversation

@mickey4653

@mickey4653 mickey4653 commented Jul 4, 2025

Copy link
Copy Markdown

🛠️ Development Environment Setup

📋 Description

This PR completes the development environment setup with proper environment variables, development tools, and code quality tools. This ensures consistent development practices across the team.

🎯 Changes Made

Environment Configuration

  • ✅ Created .env.local with Supabase configuration
  • ✅ Added proper environment variable structure
  • ✅ Configured development settings

Code Quality Tools

  • Prettier: Configured for consistent code formatting

    • Added .prettierrc with team standards
    • Added .prettierignore for exclusions
    • All files now properly formatted
  • ESLint: Set up with Next.js integration

    • Configured .eslintrc.json with Next.js and Prettier
    • Added custom rules for React best practices
    • Linting passes without errors

Git Hooks & Commit Standards

  • Husky: Installed and configured Git hooks

    • Pre-commit hook runs lint-staged
    • Commit-msg hook validates conventional commits
    • Hooks automatically format and lint staged files
  • lint-staged: Configured for staged file processing

    • Runs ESLint and Prettier on TypeScript/JavaScript files
    • Formats JSON, Markdown, and CSS files
    • Prevents commits with formatting issues
  • commitlint: Enforces conventional commit messages

    • Configured with standard commit types
    • Validates commit message format
    • Ensures consistent commit history

Development Scripts

  • ✅ All npm scripts tested and working:
    • npm run dev - Development server
    • npm run build - Production build
    • npm run lint - Code linting
    • npx tsc --noEmit - TypeScript checking

🧪 Testing

  • ✅ Environment variables properly configured
  • ✅ Prettier formatting applied to all files
  • ✅ ESLint passes without errors
  • ✅ TypeScript compilation successful
  • ✅ Production build completes successfully
  • ✅ Git hooks prevent bad commits
  • ✅ Conventional commit messages validated

📁 Files Added/Modified

New Files

  • web/.env.local - Environment configuration
  • web/.lintstagedrc.json - Lint-staged configuration
  • web/commitlint.config.js - Commit message validation
  • web/.husky/pre-commit - Pre-commit Git hook
  • web/.husky/commit-msg - Commit message Git hook

Modified Files

  • web/package.json - Added prepare script for Husky
  • web/.prettierrc - Prettier configuration
  • web/.eslintrc.json - ESLint configuration
  • All source files formatted with Prettier

🎯 Acceptance Criteria

  • .env.local file created with placeholder values
  • All development dependencies installed successfully
  • npm run lint completes without errors
  • npx prettier --check . shows all files are formatted
  • Git hooks are installed and working
  • Test commit with proper message format succeeds
  • All npm scripts work correctly

🚀 Ready for Development

The development environment is now fully configured with:

  • Automated code formatting and linting
  • Git hooks that prevent bad commits
  • Conventional commit message validation
  • Consistent development practices across the team

📚 Resources


Type: feat
Breaking Changes: None
Testing: All development scripts tested and working

Summary by CodeRabbit

  • Chores

    • Standardized environment variable names to uppercase with underscores across backend configuration and usage.
    • Updated sample data script to improve environment variable loading and data consistency.
    • Added Husky Git hooks and commitlint configuration to enforce commit message standards and automate code linting/formatting in the web project.
    • Updated package scripts to support Husky installation.
  • Style

    • Unified code style throughout the web app by converting double quotes to single quotes, removing semicolons, and standardizing formatting in TypeScript, JavaScript, and CSS files.
  • Bug Fixes

    • Corrected sample game and article data status values and author representation in the seed data script.
  • Documentation

    • Added configuration files for lint-staged and commitlint to clarify code style and commit requirements.

	- resolved Seed data bug while creating database seeding
	- fixed issue with environment variables(case sensitivity)
	- Add environment variables configuration with Supabase integration
	- Configure Prettier for consistent code formatting
	- Set up ESLint with Next.js and Prettier integration
	- Install and configure Husky for Git hooks
	- Add lint-staged for pre-commit code formatting and linting
	- Implement commitlint for conventional commit message validation
	- Test all development scripts (dev, build, lint, type-check)
	- Verify Git hooks prevent bad commits and auto-format code
@coderabbitai

coderabbitai Bot commented Jul 4, 2025

Copy link
Copy Markdown

Walkthrough

This update standardizes environment variable naming in the backend by converting all configuration fields to uppercase with underscores and updates all references accordingly. The web frontend undergoes a comprehensive code style unification, converting double quotes to single quotes, removing semicolons, and condensing formatting. Additionally, Husky Git hooks and lint-staged configurations are introduced for commit and pre-commit checks.

Changes

File(s) Change Summary
ai-backend/config/settings.py, ai-backend/main.py, ai-backend/utils/logging.py Standardized all settings attribute names to uppercase with underscores; updated all references and validators.
scripts/seed-data.py Added dotenv support, adjusted sample data fields, and kept article tags as arrays instead of JSON strings.
web/.husky/commit-msg, web/.husky/pre-commit, web/.lintstagedrc.json, web/commitlint.config.js Added Husky commit hooks, lint-staged config, and commitlint rules for consistent commit messages and code style.
web/package.json Added Husky prepare script for Git hooks installation; updated TypeScript version.
web/app/, web/components/, web/contexts/, web/hooks/ Unified code style: single quotes, removed semicolons, condensed formatting, no logic changes.
web/next.config.js, web/postcss.config.js, web/tailwind.config.js Minor formatting changes; some introduce syntax errors due to missing semicolons in exports.
web/app/globals.css Condensed CSS gradient to a single line.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Git as Git
    participant Husky as Husky Hooks
    participant LintStaged as lint-staged
    participant CommitLint as commitlint

    Dev->>Git: git commit
    Git->>Husky: Trigger pre-commit & commit-msg hooks
    Husky->>LintStaged: Run linting/formatting on staged files
    Husky->>CommitLint: Lint commit message
    CommitLint-->>Husky: Pass/Fail
    Husky-->>Git: Allow or block commit
Loading

Poem

A rabbit hopped through fields of code,
Uppercase winds in backend mode.
Quotes now single, semicolons gone,
Husky guards the commit lawn.
Linting, formatting—tidy and neat,
This codebase spring is quite a feat!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c82e561 and 9221bcf.

⛔ Files ignored due to path filters (1)
  • web/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • web/app/api/articles/route.ts (1 hunks)
  • web/app/providers.tsx (1 hunks)
  • web/components/admin/article-manager.tsx (3 hunks)
  • web/contexts/auth-context.tsx (1 hunks)
  • web/package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • web/components/admin/article-manager.tsx
  • web/app/api/articles/route.ts
  • web/package.json
  • web/app/providers.tsx
  • web/contexts/auth-context.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🔭 Outside diff range comments (3)
web/components/articles/article-card.tsx (1)

24-29: Avoid toLocaleDateString() to prevent hydration mismatch & locale-dependent rendering

new Date(createdAt).toLocaleDateString() produces locale-specific output that can differ between the Node.js SSR render and the client browser, causing a React hydration warning. It also re-formats on every render.

Consider pre-formatting the date with a deterministic library (e.g. date-fns) or ISO slicing:

-import { format } from 'date-fns'
-
-<small className="text-default-500">{new Date(createdAt).toLocaleDateString()}</small>
+import { format } from 'date-fns'
+
+<small className="text-default-500">
+  {format(new Date(createdAt), 'yyyy-MM-dd')}
+</small>

This keeps SSR/CSR output identical and avoids locale surprises.

ai-backend/main.py (1)

88-93: Agents are re-instantiated per request – heavy & defeats caching

Inside AgentOrchestrator.generate_article() you recreate all four agents even though they were already initialised in __init__. This adds unnecessary latency and resource usage.

-            configs = AgentConfigurations.get_all_configs()
-            data_collector = DataCollectorAgent(configs["data_collector"].parameters)
-            researcher = ResearchAgent(configs["researcher"].parameters)
-            writer = WritingAgent(configs["writer"].parameters)
-            editor = EditorAgent(configs["editor"].parameters)
+            # Re-use the long-lived agents initialised in __init__
+            data_collector = self.data_collector
+            researcher = self.researcher
+            writer = self.writer
+            editor = self.editor

If thread-safety is a concern, wrap agent usage with locks instead of reinstantiating.

web/components/admin/dashboard.tsx (1)

52-55: Tailwind cannot statically analyze template-literal class names

className={text-${color}} is generated at runtime, so Tailwind’s JIT compiler will purge the resulting classes (text-primary, etc.) from the final CSS bundle.

Map the colour to explicit class names instead:

const colorClass = {
  primary: 'text-primary',
  secondary: 'text-secondary',
  success: 'text-success',
  warning: 'text-warning',
  danger: 'text-danger',
}[color]

<div className={colorClass}>{icon}</div>

This guarantees the classes are present in the build output.

🧹 Nitpick comments (17)
web/app/loading.tsx (1)

4-7: Consider adding an accessible label to the Spinner.

Screen-reader users get no feedback while the page is in the loading state. Pass aria-label (or similar prop supported by @heroui/react’s Spinner) or wrap with role="status" + visually-hidden text.

-      <Spinner size="lg" />
+      <Spinner size="lg" aria-label="Loading content…" />
web/app/layout.tsx (2)

7-10: Consider typing metadata explicitly
Adding as const (or an explicit Metadata type from next) ensures the object remains read-only and benefits from stronger IntelliSense in consuming files.

-export const metadata = {
-  title: 'Sport Scribe - AI-Powered Sports Journalism',
-  description: 'Intelligent sports journalism platform using multi-agent AI',
-}
+export const metadata = {
+  title: 'Sport Scribe - AI-Powered Sports Journalism',
+  description: 'Intelligent sports journalism platform using multi-agent AI',
+} as const

14-16: Duplicate suppressHydrationWarning attribute
You’re passing suppressHydrationWarning to both <html> and <body>. The Next.js docs recommend applying it only to the element whose mismatches you expect (typically <body>). Keeping it in two places is redundant and may mask unexpected hydration issues higher up.

-<html lang="en" suppressHydrationWarning>
+<html lang="en">
web/app/error.tsx (2)

6-12: Suppress the noShadowRestrictedNames lint warning in-place rather than renaming the component

The component must be exported as Error for Next 13’s error.tsx convention to work.
Renaming it would break the automatic error boundary, but the current name shadows the global
Error constructor, which triggers lint/suspicious/noShadowRestrictedNames.

Silence the rule locally so the Husky / lint-staged pipeline stays green:

-export default function Error({
+// biome-ignore lint/suspicious/noShadowRestrictedNames -- Next.js requires the component to be named `Error`.
+export default function Error({

14-15: Consider routing errors to an external logger instead of console.error

Browser consoles are easily missed in production. Forwarding error to a telemetry
service (e.g. Sentry, LogRocket) gives you alerting and traceability.

No action required for functionality, but worth adding before release.

web/app/globals.css (1)

21-22: Prefer explicit comma to delimit the gradient layer from the fallback color

CSS accepts the current shorthand, but adding an explicit comma between the linear-gradient and the solid color makes the two background layers unambiguous and aligns with common style-guide recommendations.

-  background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb)))
-    rgb(var(--background-start-rgb));
+  background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))),
+    rgb(var(--background-start-rgb));
web/components/ui/hero-input.tsx (1)

7-9: Preserve refs with React.forwardRef
Wrapping Input in your own component drops the consumer’s ref, which is frequently needed for focusing/error handling. Consider:

-import { Input, InputProps } from '@heroui/react'
+import { forwardRef } from 'react'
+import { Input, InputProps } from '@heroui/react'

-export function HeroInput({ ...props }: HeroInputProps) {
-  return <Input {...props} />
-}
+export const HeroInput = forwardRef<HTMLInputElement, HeroInputProps>(
+  (props, ref) => <Input ref={ref} {...props} />,
+)
web/app/admin/page.tsx (1)

33-34: Semicolon removal is purely stylistic
Just ensure semi:false (or equivalent) is enforced in the shared Prettier config to avoid churn.

web/app/not-found.tsx (1)

5-13: Optional: add metadata for better 404 SEO
Although outside the style diff, adding export const metadata = { title: '404 – Not Found' } helps Next.js set correct meta tags.

web/components/ui/hero-button.tsx (1)

7-9: Forward refs for better composability
As with HeroInput, expose the underlying Button ref via React.forwardRef to allow consumers to call .focus() etc.

web/tailwind.config.js (1)

6-10: Avoid scanning non-existent tsx files inside node_modules to keep Tailwind compilation fast

@heroui/theme/dist only ships JavaScript; including *.tsx will cause Tailwind to walk thousands of files that cannot possibly contain class names, slowing startup & HMR.

-    './node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}',
+    './node_modules/@heroui/theme/dist/**/*.{js,ts}',
web/components/ui/loading-wrapper.tsx (1)

11-19: Minor naming/readability nit

mounted is a boolean; prefixing with is/has makes intent clearer and avoids the occasional “mounted is not a function” typo.

-  const [mounted, setMounted] = useState(false)
+  const [isMounted, setIsMounted] = useState(false)
   ...
-  if (!mounted) {
+  if (!isMounted) {
     return fallback || null
   }
web/app/api/webhooks/article-generated/route.ts (1)

13-21: Replace console.* with the project’s logger before shipping

Raw console.log/error calls get dropped in serverless prod and make log aggregation harder.
Hook into whatever structured logger the rest of the API uses (e.g. pino, winston, next-logger) once the TODO items are addressed.

web/.husky/pre-commit (1)

4-4: Harden the directory switch

If the repo root is renamed or contains spaces the unquoted cd could fail silently. Minor but cheap to fix:

-cd web && npx lint-staged 
+cd "web" || exit 1
+npx lint-staged

Adds a guard and quotes the path.

web/components/articles/related-articles.tsx (1)

20-22: Minor perf-win: memoise the 3-item slice
articles.slice(0, 3) re-runs on every render, even when articles hasn’t changed. Wrapping the slice in useMemo (keyed by articles) prevents needless allocations on re-renders from an unrelated state change.

+ const topThree = React.useMemo(() => articles.slice(0, 3), [articles])- {articles.slice(0, 3).map((article) => (
+ {topThree.map((article) => (
    <ArticleCard key={article.id} {...article} />
  ))}
web/components/articles/article-content.tsx (1)

34-38: Avoid using list index as React key
Using the array index as the key can cause unnecessary DOM churn if paragraph order ever changes. A stable key (e.g., a hash of the paragraph text) is safer.

- {content.split('\n').map((paragraph, index) => (
-   <p key={index} className="mb-4">
+ {content
+   .split('\n')
+   .filter(Boolean)
+   .map((paragraph) => (
+     <p key={paragraph.slice(0, 40)} className="mb-4">
        {paragraph}
      </p>
   ))}
web/components/admin/article-manager.tsx (1)

28-92: Component length exceeds 50-line threshold – extract a ManagedArticleRow sub-component

Static analysis flagged 60 LOC. Splitting the table row rendering into its own component will:

  • Satisfy the linter
  • Improve readability & testability
  • Reduce re-render surface area when memoised

No diff given because the refactor spans multiple sections.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 807bf41 and c82e561.

📒 Files selected for processing (52)
  • ai-backend/config/settings.py (3 hunks)
  • ai-backend/main.py (4 hunks)
  • ai-backend/utils/logging.py (1 hunks)
  • scripts/seed-data.py (4 hunks)
  • web/.husky/commit-msg (1 hunks)
  • web/.husky/pre-commit (1 hunks)
  • web/.lintstagedrc.json (1 hunks)
  • web/app/admin/analytics/page.tsx (2 hunks)
  • web/app/admin/articles/page.tsx (2 hunks)
  • web/app/admin/page.tsx (2 hunks)
  • web/app/api/analytics/route.ts (2 hunks)
  • web/app/api/articles/[id]/route.ts (1 hunks)
  • web/app/api/articles/route.ts (1 hunks)
  • web/app/api/health/route.ts (1 hunks)
  • web/app/api/webhooks/article-generated/route.ts (1 hunks)
  • web/app/articles/[id]/page.tsx (2 hunks)
  • web/app/articles/page.tsx (2 hunks)
  • web/app/error.tsx (2 hunks)
  • web/app/globals.css (1 hunks)
  • web/app/layout.tsx (1 hunks)
  • web/app/loading.tsx (1 hunks)
  • web/app/not-found.tsx (2 hunks)
  • web/app/page.tsx (2 hunks)
  • web/app/providers.tsx (1 hunks)
  • web/app/sports/[sport]/page.tsx (1 hunks)
  • web/app/sports/page.tsx (2 hunks)
  • web/commitlint.config.js (1 hunks)
  • web/components/admin/analytics-panel.tsx (5 hunks)
  • web/components/admin/article-manager.tsx (3 hunks)
  • web/components/admin/dashboard.tsx (8 hunks)
  • web/components/articles/article-card.tsx (4 hunks)
  • web/components/articles/article-content.tsx (2 hunks)
  • web/components/articles/article-grid.tsx (2 hunks)
  • web/components/articles/related-articles.tsx (2 hunks)
  • web/components/layout/footer.tsx (1 hunks)
  • web/components/layout/header.tsx (1 hunks)
  • web/components/layout/navigation.tsx (2 hunks)
  • web/components/ui/hero-button.tsx (1 hunks)
  • web/components/ui/hero-card.tsx (1 hunks)
  • web/components/ui/hero-input.tsx (1 hunks)
  • web/components/ui/hero-navbar.tsx (2 hunks)
  • web/components/ui/loading-wrapper.tsx (1 hunks)
  • web/components/ui/theme-provider.tsx (2 hunks)
  • web/contexts/auth-context.tsx (1 hunks)
  • web/contexts/theme-context.tsx (1 hunks)
  • web/hooks/use-analytics.ts (1 hunks)
  • web/hooks/use-articles.ts (2 hunks)
  • web/hooks/use-supabase.ts (1 hunks)
  • web/next.config.js (1 hunks)
  • web/package.json (1 hunks)
  • web/postcss.config.js (1 hunks)
  • web/tailwind.config.js (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (11)
web/app/api/webhooks/article-generated/route.ts (1)
web/app/api/articles/route.ts (1)
  • POST (24-39)
web/components/layout/header.tsx (1)
web/components/ui/hero-navbar.tsx (1)
  • HeroNavbar (4-35)
web/app/providers.tsx (2)
web/components/ui/theme-provider.tsx (1)
  • ThemeProvider (7-31)
web/contexts/theme-context.tsx (1)
  • ThemeProvider (15-70)
web/components/articles/related-articles.tsx (1)
web/components/articles/article-card.tsx (1)
  • ArticleCardProps (4-11)
web/components/articles/article-grid.tsx (1)
web/components/articles/article-card.tsx (1)
  • ArticleCardProps (4-11)
web/components/ui/theme-provider.tsx (1)
web/contexts/theme-context.tsx (1)
  • ThemeProvider (15-70)
web/hooks/use-analytics.ts (2)
web/components/admin/analytics-panel.tsx (1)
  • AnalyticsData (3-11)
web/app/error.tsx (1)
  • Error (6-25)
web/hooks/use-supabase.ts (1)
web/lib/supabase/client.ts (1)
  • createClient (4-8)
web/app/api/articles/[id]/route.ts (3)
web/app/api/analytics/route.ts (1)
  • GET (4-24)
web/app/api/health/route.ts (1)
  • GET (3-10)
web/app/api/articles/route.ts (1)
  • GET (4-21)
web/components/admin/analytics-panel.tsx (1)
web/hooks/use-analytics.ts (1)
  • AnalyticsData (5-22)
web/app/layout.tsx (1)
web/app/providers.tsx (1)
  • Providers (6-12)
🪛 Biome (1.9.4)
web/app/error.tsx

[error] 6-6: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

🪛 GitHub Check: Codacy Static Code Analysis
web/components/admin/article-manager.tsx

[warning] 28-28: web/components/admin/article-manager.tsx#L28
Method ArticleManager has 60 lines of code (limit is 50)

🪛 Pylint (3.3.7)
ai-backend/config/settings.py

[error] 60-60: Method 'validate_openai_key' should have "self" as first argument

(E0213)


[error] 68-68: Method 'validate_supabase_url' should have "self" as first argument

(E0213)


[error] 76-76: Method 'validate_environment' should have "self" as first argument

(E0213)


[error] 83-83: Method 'validate_log_level' should have "self" as first argument

(E0213)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (49)
web/app/loading.tsx (1)

1-1: Style change aligns with repo-wide conventions – looks good.
Nothing functional here, import path remains untouched; switch to single quotes is consistent with the new Prettier rules.

web/app/layout.tsx (1)

1-3: Stylistic cleanup looks good
Imports were updated to single quotes and unused semicolons removed, aligning with the new Prettier rules introduced in this PR. 👍

web/components/ui/hero-input.tsx (1)

1-1: Style change looks good
Quotes are now single and consistent with the repo’s new Prettier rules.

web/app/admin/page.tsx (1)

1-2: Consistent import style – LGTM
Single-quote conversion aligns with repo standards.

web/app/not-found.tsx (1)

1-2: Import quote update confirmed
Matches the global formatting rules.

web/components/layout/footer.tsx (1)

12-13: Trailing semicolon dropped—fine
No functional impact; consistent with new lint rules.

web/components/ui/hero-button.tsx (1)

1-1: Import quote change approved
Aligns with project formatting.

web/app/api/analytics/route.ts (1)

1-24: LGTM! Code style standardization looks good.

The stylistic changes consistently convert double quotes to single quotes and remove unnecessary semicolons, improving code consistency across the codebase without affecting functionality.

web/app/page.tsx (1)

1-26: LGTM! Consistent formatting improvements.

The stylistic changes enhance code consistency by standardizing quote usage and improving JSX formatting without altering component functionality.

web/app/api/health/route.ts (1)

1-10: LGTM! Stylistic improvements are consistent.

The quote style standardization aligns with the broader code formatting improvements across the project.

web/postcss.config.js (1)

6-6: LGTM! Semicolon removal is consistent with modern style.

The formatting change aligns with the project's code style standardization while maintaining valid JavaScript syntax.

web/components/layout/navigation.tsx (1)

1-27: LGTM! Comprehensive stylistic improvements.

The formatting changes consistently apply the new code style standards across imports, data structures, and JSX return statements without affecting component functionality.

web/next.config.js (1)

6-8: LGTM! Stylistic changes are syntactically correct.

The removal of semicolons is valid JavaScript and aligns with the code style standardization effort. These changes don't introduce syntax errors as JavaScript supports automatic semicolon insertion (ASI).

web/components/ui/theme-provider.tsx (2)

1-12: LGTM! Consistent code style standardization.

The changes properly standardize the code style by converting double quotes to single quotes and removing semicolons. These modifications align with the PR's code formatting objectives and don't affect the component's functionality.


30-30: LGTM! Return statement formatting is improved.

The condensed return statement formatting enhances readability while maintaining the same functionality.

web/app/sports/page.tsx (2)

1-4: LGTM! Import statements and array formatting standardized.

The conversion to single quotes and condensed array formatting improves code consistency and readability without affecting functionality.


18-26: LGTM! JSX formatting improvements.

The condensed Button component props and return statement formatting enhance code readability while maintaining the same functionality.

web/components/ui/hero-card.tsx (2)

1-8: LGTM! Interface and import standardization.

The conversion to single quotes and removal of semicolons in the interface properties aligns with the code style standards. The component's TypeScript interface remains functionally identical.


15-15: LGTM! Return statement formatting improved.

The condensed return statement formatting enhances readability while maintaining the same component functionality.

web/app/sports/[sport]/page.tsx (2)

1-7: LGTM! Import and interface standardization.

The conversion to single quotes and removal of semicolons in the interface properties maintains consistent code style throughout the codebase. The component's functionality remains unchanged.


12-25: LGTM! JSX formatting improvements.

The condensed JSX element formatting and return statement improve code readability while preserving the same page functionality and dynamic routing behavior.

web/hooks/use-supabase.ts (1)

1-56: LGTM! Consistent stylistic improvements applied.

The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for Supabase authentication, session management, and auth state handling remains intact and unchanged.

web/contexts/theme-context.tsx (1)

1-78: LGTM! Consistent stylistic improvements applied.

The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for theme management, localStorage persistence, and system theme detection remains intact and unchanged.

web/hooks/use-articles.ts (1)

1-176: LGTM! Consistent stylistic improvements applied.

The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for article management, including data fetching, filtering, validation, and error handling, remains intact and unchanged.

web/hooks/use-analytics.ts (1)

1-61: LGTM! Consistent stylistic improvements applied.

The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for analytics data management, including API calls, error handling, and state management, remains intact and unchanged.

web/app/api/articles/[id]/route.ts (1)

1-52: LGTM! Consistent stylistic improvements applied.

The formatting changes successfully standardize the code style by converting double quotes to single quotes and consolidating multiline function parameters. All functional logic for the article API endpoints (GET, PUT, DELETE) remains intact and unchanged, with placeholder implementations preserved for future database integration.

web/app/articles/page.tsx (1)

1-20: LGTM – purely stylistic touches
No behavioural changes detected; import path and JSX still valid.

web/app/admin/analytics/page.tsx (1)

1-35: Looks good – style unification only
No functional alterations; component still renders as before.

web/components/layout/header.tsx (1)

1-9: Header refactor approved
Import path and JSX remain correct; change is cosmetic.

web/app/admin/articles/page.tsx (1)

17-18: Looks good – style-only touch-up
No functional deltas; the split string still renders as expected.

web/package.json (1)

42-44: Husky hook wired correctly
The trailing comma plus the new prepare script conform to Husky’s install pattern. 👍

web/components/ui/hero-navbar.tsx (1)

1-2: LGTM – consolidated imports only
Pure formatting; no functional changes introduced.

web/.husky/commit-msg (1)

1-4: LGTM! Well-structured Husky commit-msg hook.

The script correctly follows Husky conventions by sourcing the environment setup, changing to the appropriate directory, and running commitlint with the commit message file argument.

web/.lintstagedrc.json (1)

1-5: LGTM! Comprehensive lint-staged configuration.

The configuration properly handles different file types with appropriate tooling:

  • ESLint with auto-fix followed by Prettier for TypeScript/JavaScript files
  • Prettier-only formatting for JSON, Markdown, and CSS files

This ensures consistent code quality and formatting across the project.

web/commitlint.config.js (1)

1-18: LGTM! Well-configured commitlint setup.

The configuration correctly extends the conventional commitlint config and defines a comprehensive set of commit types with helpful comments. The error-level enforcement ensures strict adherence to commit message standards.

web/app/articles/[id]/page.tsx (3)

1-1: LGTM! Consistent import formatting.

The change from double quotes to single quotes aligns with the project's code style standardization.


5-6: LGTM! Consistent interface formatting.

The removal of trailing semicolons follows modern TypeScript conventions and maintains consistency with the project's formatting standards.


19-24: LGTM! Consistent JSX formatting.

The condensed formatting maintains readability while following the project's style guidelines.

ai-backend/utils/logging.py (1)

127-128: ✔ Settings configuration updated to use uppercase attributes

The Settings class in ai-backend/config/settings.py now defines and validates both LOG_LEVEL (line 50) and LOG_FORMAT (line 51), and these are consistently referenced in main.py and utils/logging.py. No further changes are needed—LGTM.

web/components/articles/article-grid.tsx (1)

1-14: LGTM – purely stylistic changes
No functional or performance concerns spotted.

scripts/seed-data.py (4)

13-20: Good practice: Environment variable loading with graceful fallback.

The dotenv loading implementation handles the missing dependency gracefully while providing clear installation instructions. This ensures the script can work in environments where python-dotenv isn't installed.


75-75: Appropriate change for AI-generated content representation.

Changing from "author" to "author_id": None is a logical improvement that properly represents AI-generated content in the data model, aligning with relational database design principles.


178-179: Confirm database schema for tags column

It appears that in scripts/seed-data.py we’re correctly keeping tags as an array (and the JSON‐dump line is commented out), and there are no other code paths converting tags to strings. Before merging, please verify that your database schema and any ORM/model definitions expect and persist tags as an array type (e.g. TEXT[] or JSONB) rather than a JSON string.

Files/locations to double‐check:

  • supabase/migrations/*.sql (look for CREATE TABLE articles and the tags column definition)
  • Any ORM or schema files (GraphQL, Pydantic models, etc.) referencing tags

No changes to application code are needed if your tags column is already defined as an array.


56-56: Verify support for the new “final” game status

I searched the codebase for any database models or application logic that define or validate game status values and did not find an enum/constraint for game.status. Please ensure that:

  • Your database schema (e.g. enum column, constraint, migration) allows “final” as a valid game status
  • Any service or query consuming the game.status field is updated to handle “final” (instead of “completed”)

File needing attention:

  • scripts/seed-data.py (around line 56): "status": "final",
web/components/admin/analytics-panel.tsx (1)

1-91: LGTM: Consistent code style improvements.

The changes are purely stylistic, converting double quotes to single quotes and removing semicolons for consistency with the project's code style. The component's functionality, TypeScript interfaces, and rendering logic remain unchanged.

ai-backend/config/settings.py (4)

24-58: Excellent: Systematic environment variable naming standardization.

The conversion to uppercase with underscores (e.g., OPENAI_API_KEY, SUPABASE_URL) follows standard environment variable naming conventions and improves consistency across the application.


59-95: Validator decorators correctly updated.

All Pydantic validator decorators have been properly updated to reference the new uppercase field names. The static analysis hints about missing "self" parameter are false positives - Pydantic validators correctly use cls as the first argument.


100-111: Dictionary method properly updated for new field names.

The to_dict method correctly references all the new uppercase field names while maintaining the same return structure and excluding sensitive values.


120-121: Good addition: Backward compatibility support.

Adding populate_by_name = True to the Pydantic Config allows the settings to be populated using both the new field names and any potential aliases, providing backward compatibility during the transition.

Comment thread web/app/providers.tsx Outdated
Comment thread web/app/api/articles/route.ts
Comment thread web/contexts/auth-context.tsx
Comment thread web/components/admin/article-manager.tsx
Comment thread web/components/admin/article-manager.tsx Outdated
	- Replace deprecated Math.random().toString(36).substr() with crypto.randomUUID()
	  for robust ID generation in articles API route

	- Optimize auth context performance by stabilizing Supabase client instance
	  using useMemo to prevent unnecessary re-subscriptions

	- Fix SSR hydration risk in article manager by using deterministic date
	  formatting with fixed 'en-CA' locale

	- Improve article manager component by extracting getStatusColor function
	  outside component and adding proper TypeScript typing with union types

	- Remove redundant HeroUIProvider wrapper in providers to eliminate
	  unnecessary nesting and potential context identity issues

	- Fix TypeScript version compatibility warning by downgrading to 5.3.3
	  to match @typescript-eslint/typescript-estree supported range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant