Skip to content

Task1: Write simple "Guess a number" game#41

Merged
AndriySmolskyy merged 9 commits intoKernel-GL-HRK:Olena.Kryzhanivskafrom
saurier:task1
Mar 27, 2023
Merged

Task1: Write simple "Guess a number" game#41
AndriySmolskyy merged 9 commits intoKernel-GL-HRK:Olena.Kryzhanivskafrom
saurier:task1

Conversation

@saurier
Copy link

@saurier saurier commented Jan 6, 2023

Add .gitignore file and guecc.s file with "Guess a number" game. Random generator function is separate.

a-vodka and others added 8 commits December 22, 2022 16:54
Signed-off-by: Oleksii Vodka <oleksii.vodka@gmail.com>
Signed-off-by: Oleksii Vodka <oleksii.vodka@gmail.com>
Signed-off-by: Oleksii Vodka <oleksii.vodka@gmail.com>
Signed-off-by: saurier <kruzhanivska.olena212@gmail.com>
Signed-off-by: saurier <kruzhanivska.olena212@gmail.com>
Signed-off-by: saurier <kruzhanivska.olena212@gmail.com>
Signed-off-by: saurier <kruzhanivska.olena212@gmail.com>
Signed-off-by: saurier <kruzhanivska.olena212@gmail.com>
@alexposukhov
Copy link
Contributor

Please use labels if your pull request is ready for review

@saurier saurier added the Ready for review Ready to be reviewed label Jan 7, 2023
@AndriySmolskyy
Copy link
Contributor

Should the guess.c file pass checkpatch.pl check?

glas@glas-ThinkPad-T450s:~/Projects/GL/BaseCamp_LinuxKernel/workspace/tmp/task1-simple-program$ ./checkpatch.pl --no-tree -f guess.c
No typos will be found - file '/home/glas/Projects/GL/BaseCamp_LinuxKernel/workspace/tmp/task1-simple-program/spelling.txt': No such file or directory
No structs that should be const will be found - file '/home/glas/Projects/GL/BaseCamp_LinuxKernel/workspace/tmp/task1-simple-program/const_structs.checkpatch': No such file or directory
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: guess.c:1:
+#include <stdlib.h>

ERROR: do not initialise globals to 0
#5: FILE: guess.c:5:
+int compNumber = 0;

ERROR: Bad function definition - void generateRandom() should probably be void generateRandom(void)
#7: FILE: guess.c:7:
+void generateRandom()

ERROR: Bad function definition - int main() should probably be int main(void)
#13: FILE: guess.c:13:
+int main()

WARNING: please, no spaces at the start of a line
#15: FILE: guess.c:15:

  • int guestNumber;$

WARNING: Missing a blank line after declarations
#16: FILE: guess.c:16:

  • int guestNumber;
  • printf("Welcome to Guess a number!\nEnter your number (0-9):");

WARNING: please, no spaces at the start of a line
#16: FILE: guess.c:16:

  • printf("Welcome to Guess a number!\nEnter your number (0-9):");$

WARNING: please, no spaces at the start of a line
#17: FILE: guess.c:17:

  • scanf("%d", &guestNumber);$

WARNING: please, no spaces at the start of a line
#18: FILE: guess.c:18:

  • generateRandom();$

WARNING: please, no spaces at the start of a line
#20: FILE: guess.c:20:

  • if(compNumber==guestNumber)$

ERROR: that open brace { should be on the previous line
#20: FILE: guess.c:20:

  • if(compNumber==guestNumber)
  • {

ERROR: spaces required around that '==' (ctx:VxV)
#20: FILE: guess.c:20:

  • if(compNumber==guestNumber)
    ^

ERROR: space required before the open parenthesis '('
#20: FILE: guess.c:20:

  • if(compNumber==guestNumber)

WARNING: please, no spaces at the start of a line
#21: FILE: guess.c:21:

  • {$

ERROR: code indent should use tabs where possible
#22: FILE: guess.c:22:

  •    printf("You win!\n");$
    

WARNING: please, no spaces at the start of a line
#22: FILE: guess.c:22:

  •    printf("You win!\n");$
    

ERROR: code indent should use tabs where possible
#23: FILE: guess.c:23:

  •    return 0;$
    

WARNING: please, no spaces at the start of a line
#23: FILE: guess.c:23:

  •    return 0;$
    

WARNING: please, no spaces at the start of a line
#24: FILE: guess.c:24:

  • }$

WARNING: please, no spaces at the start of a line
#25: FILE: guess.c:25:

  • else$

ERROR: that open brace { should be on the previous line
#25: FILE: guess.c:25:

  • else
  • {

ERROR: else should follow close brace '}'
#25: FILE: guess.c:25:

  • }
  • else

WARNING: please, no spaces at the start of a line
#26: FILE: guess.c:26:

  • {$

ERROR: code indent should use tabs where possible
#27: FILE: guess.c:27:

  •    printf("You loose!\n");$
    

WARNING: please, no spaces at the start of a line
#27: FILE: guess.c:27:

  •    printf("You loose!\n");$
    

ERROR: code indent should use tabs where possible
#28: FILE: guess.c:28:

  •    return 1;$
    

WARNING: please, no spaces at the start of a line
#28: FILE: guess.c:28:

  •    return 1;$
    

WARNING: please, no spaces at the start of a line
#29: FILE: guess.c:29:

  • }$

total: 12 errors, 16 warnings, 30 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

NOTE: Whitespace errors detected.
You may wish to use scripts/cleanpatch or scripts/cleanfile

guess.c has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

Copy link
Contributor

@AndriySmolskyy AndriySmolskyy left a comment

Choose a reason for hiding this comment

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

The task1-simple-program/guess.c doesn't pass checking with checkpatch.pl

@saurier
Copy link
Author

saurier commented Mar 23, 2023

Check please

@saurier saurier requested a review from AndriySmolskyy March 23, 2023 18:54
@AndriySmolskyy AndriySmolskyy merged commit 831593d into Kernel-GL-HRK:Olena.Kryzhanivska Mar 27, 2023
@saurier saurier removed the Ready for review Ready to be reviewed label Mar 30, 2023
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.

4 participants