Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Default owner for all files
* @roman-rouba
21 changes: 21 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Description
<!-- What this pr is for -->

## Ticket
<!-- Jira ticket number -->

## Screenshot/Video (optional)
<!-- Demonstration of changes -->

# Checklist
<!-- Checklist to be followed by the author -->
- [ ] Linters passed
- [ ] Tests passed
- [ ] Documentation updated (if needed)

# Review level
<!-- Who is needed for this review -->
- [ ] Standard review (peer review by 1-2 developers)
- [ ] Techlead/Architect review required
- [ ] QA review required

110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
push:
branches: [ main, 'CALC-*' ]
pull_request:
branches: [ main ]

jobs:
validate:
name: Validate HTML and Code Quality
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Validate HTML file exists
run: |
if [ ! -f index.html ]; then
echo "❌ Error: index.html not found"
exit 1
fi
echo "✅ index.html exists"

- name: Check HTML structure
run: |
# Check for required HTML elements
if ! grep -q "<!DOCTYPE html>" index.html; then
echo "❌ Missing DOCTYPE declaration"
exit 1
fi
if ! grep -q "<html" index.html; then
echo "❌ Missing <html> tag"
exit 1
fi
if ! grep -q "<head" index.html; then
echo "❌ Missing <head> tag"
exit 1
fi
if ! grep -q "<body" index.html; then
echo "❌ Missing <body> tag"
exit 1
fi
echo "✅ Basic HTML structure is valid"

- name: Validate JavaScript syntax
run: |
# Extract JavaScript content
awk '/<script>/,/<\/script>/' index.html | sed '1d;$d' > /tmp/extracted.js

# Check if JavaScript exists
if [ -s /tmp/extracted.js ]; then
echo "Validating JavaScript syntax..."
node --check /tmp/extracted.js && echo "✅ JavaScript syntax is valid" || {
echo "⚠️ JavaScript validation skipped (inline script may have issues)"
}
else
echo "⚠️ No JavaScript found to validate"
fi

- name: Check for common issues
run: |
# Check for console.log (should be removed in production)
if grep -q "console\.log" index.html; then
echo "⚠️ Warning: console.log found in code"
fi

# Check for TODO/FIXME comments
if grep -qi "TODO\|FIXME" index.html; then
echo "ℹ️ Info: TODO/FIXME comments found"
fi

# Check file size (should be reasonable)
SIZE=$(wc -c < index.html)
if [ $SIZE -gt 100000 ]; then
echo "⚠️ Warning: index.html is larger than 100KB"
fi
echo "✅ Code quality checks passed"

- name: Display repository structure
run: |
echo "📁 Repository structure:"
find . -type f -not -path './.git/*' -not -path './node_modules/*' | sort

html-validate:
name: HTML Validation
runs-on: ubuntu-latest
continue-on-error: true

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install html-validate
run: npm install -g html-validate

- name: Validate HTML
run: |
html-validate index.html || echo "HTML validation completed with warnings"
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini

# Editor directories and files
.vscode/
.idea/
*.swp
*.swo
*~
.project
.classpath
.settings/

# Temporary files
*.tmp
*.temp
*.log
PR_DESCRIPTION.md

# Node modules (if you add npm packages later)
node_modules/
package-lock.json
yarn.lock

# Build outputs
dist/
build/
*.min.js
*.min.css

# Environment files
.env
.env.local
.env.*.local

9 changes: 9 additions & 0 deletions .htmlvalidate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["html-validate:recommended"],
"rules": {
"valid-id": "off",
"no-inline-style": "warn",
"no-missing-references": "off"
}
}

71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Calculator Application

A simple, modern calculator web application built with vanilla HTML, CSS, and JavaScript.

## Features

- Basic arithmetic operations (addition, subtraction, multiplication)
- Clean and intuitive user interface
- Responsive design
- Real-time calculation display

## Getting Started

Simply open `index.html` in your web browser. No build process or dependencies required.

## Usage

1. Click number buttons to enter digits
2. Click an operator button (+, -, *) to select an operation
3. Enter the second number
4. Click the equals (=) button to calculate the result
5. Click Clear (C) to reset the calculator

## Project Structure

```
tl_tech_task/
├── index.html # Main calculator application
├── README.md # Project documentation
├── .htmlvalidate.json # HTML validation configuration
└── .github/ # GitHub templates and workflows
├── pull_request_template.md
└── workflows/
└── ci.yml # GitHub Actions CI workflow
```

## Development

This is a single-file application. All HTML, CSS, and JavaScript are contained in `index.html`.

## Contributing

We welcome contributions! Please follow these guidelines:

1. **Branch Naming**: Use the format `feature/<issue>-description`
- Example: `feature/CALC-4-add-division`
- Fork the repository and create your branch from the fork

2. **Keep PRs Small**: Pull requests should be under 500 lines of code
- Break large features into smaller, focused PRs
- Each PR should address a single concern

3. **Requirements Before Merging**:
- ✅ CI checks must pass
- ✅ 1-2 approvals required
- ✅ Code owner review (if CODEOWNERS is configured)

## CI/CD

This repository uses GitHub Actions for continuous integration. The CI workflow automatically:
- Validates HTML structure and syntax
- Checks JavaScript syntax
- Performs code quality checks
- Runs on every push and pull request

See `.github/workflows/ci.yml` for the complete CI configuration.

## License

[Add your license here]

3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="display" id="display">0</div>
<div class="buttons">
<button class="clear" id="clear">C</button>
<button class="operator disabled" id="divide">/</button> <button class="operator disabled" id="multiply">*</button> <button class="number">7</button>
<button class="operator disabled" id="divide">/</button> <button class="operator" id="multiply">*</button> <button class="number">7</button>
<button class="number">8</button>
<button class="number">9</button>
<button class="operator" id="subtract">-</button>
Expand Down Expand Up @@ -74,6 +74,7 @@
switch (operator) {
case '+': result = firstOperand + secondOperand; break;
case '-': result = firstOperand - secondOperand; break;
case '*': result = firstOperand * secondOperand; break;
}
currentInput = result.toString();
operator = null;
Expand Down