Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added famous fizz-buzz question #122

Merged
merged 1 commit into from
Jul 28, 2019
Merged

Conversation

tintinthong
Copy link
Contributor

@tintinthong tintinthong commented Jul 20, 2019

This is my first PR. Apologies if I am not used to how you guys work.

I have added the famous Fizz Buzz question. Few notes:

  1. I excluded tests for inputs since I figured beginners will not be handling these.
    2.I removed context() in all my test file as it was written as out-of-date in the package.

Please let me know if I can improve on anything.

@lintr-bot

This comment has been minimized.

2 similar comments
@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:13:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/example.R:13:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/fizz-buzz.R:1:10: style: Put spaces around all infix operators.

fizz_buzz<-function(input){
        ~^~~

exercises/fizz-buzz/fizz-buzz.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/fizz-buzz.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/fizz-buzz.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/fizz-buzz.R:11:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/fizz-buzz.R:11:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:4:1: style: Variable and function names should be all lowercase.

solMethod <- function(input) {
^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:5:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:16:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/test_fizz-buzz.R:16:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:20:31: style: Commas should always have a space after.

​  expect_length(fizz_buzz(10),10)
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:23:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:24:35: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10), solMethod(10))
                                  ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:25:36: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(100), solMethod(100))
                                   ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:26:38: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10000), solMethod(10000))
                                     ^~~~~~~~~

@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:13:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/example.R:13:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/fizz-buzz.R:1:10: style: Put spaces around all infix operators.

fizz_buzz<-function(input){
        ~^~~

exercises/fizz-buzz/fizz-buzz.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/fizz-buzz.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/fizz-buzz.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/fizz-buzz.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/fizz-buzz.R:11:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/fizz-buzz.R:11:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:4:1: style: Variable and function names should be all lowercase.

solMethod <- function(input) {
^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:5:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:16:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/test_fizz-buzz.R:16:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:20:31: style: Commas should always have a space after.

​  expect_length(fizz_buzz(10),10)
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:23:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:24:35: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10), solMethod(10))
                                  ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:25:36: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(100), solMethod(100))
                                   ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:26:38: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10000), solMethod(10000))
                                     ^~~~~~~~~

@lintr-bot

This comment has been minimized.

2 similar comments
@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:13:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/example.R:13:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/fizz-buzz.R:1:10: style: Put spaces around all infix operators.

fizz_buzz<-function(input){
        ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:4:1: style: Variable and function names should be all lowercase.

solMethod <- function(input) {
^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:5:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:16:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/test_fizz-buzz.R:16:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:20:31: style: Commas should always have a space after.

​  expect_length(fizz_buzz(10),10)
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:23:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:24:35: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10), solMethod(10))
                                  ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:25:36: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(100), solMethod(100))
                                   ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:26:38: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10000), solMethod(10000))
                                     ^~~~~~~~~

@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:13:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/example.R:13:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/fizz-buzz.R:1:10: style: Put spaces around all infix operators.

fizz_buzz<-function(input){
        ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:4:1: style: Variable and function names should be all lowercase.

solMethod <- function(input) {
^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:5:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:6:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:8:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:10:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/test_fizz-buzz.R:16:24: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                       ^

exercises/fizz-buzz/test_fizz-buzz.R:16:31: style: Commas should always have a space after.

return (sapply(seq(1,input),condition))
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:20:31: style: Commas should always have a space after.

​  expect_length(fizz_buzz(10),10)
                              ^

exercises/fizz-buzz/test_fizz-buzz.R:23:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:24:35: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10), solMethod(10))
                                  ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:25:36: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(100), solMethod(100))
                                   ^~~~~~~~~

exercises/fizz-buzz/test_fizz-buzz.R:26:38: style: Variable and function names should be all lowercase.

​  expect_identical(fizz_buzz(10000), solMethod(10000))
                                     ^~~~~~~~~

@lintr-bot

This comment has been minimized.

2 similar comments
@lintr-bot
Copy link

exercises/fizz-buzz/example.R:1:11: style: Use <-, not =, for assignment.

fizz_buzz = function(input) {
          ^

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:14:6: style: Put spaces around all infix operators.

out<-sapply(seq(1,input),condition)
    ~^~~

exercises/fizz-buzz/example.R:14:21: style: Commas should always have a space after.

out<-sapply(seq(1,input),condition)
                    ^

exercises/fizz-buzz/example.R:14:28: style: Commas should always have a space after.

out<-sapply(seq(1,input),condition)
                           ^

exercises/fizz-buzz/example.R:15:19: style: Commas should always have a space after.

return (cat(out,sep="\n"))
                  ^

exercises/fizz-buzz/example.R:15:22: style: Put spaces around all infix operators.

return (cat(out,sep="\n"))
                    ~^~

exercises/fizz-buzz/fizz-buzz.R:1:11: style: Use <-, not =, for assignment.

fizz_buzz = function(input){
          ^

exercises/fizz-buzz/test_fizz-buzz.R:4:6: style: Use <-, not =, for assignment.

ans10="1
     ^

exercises/fizz-buzz/test_fizz-buzz.R:4:6: style: Put spaces around all infix operators.

ans10="1
    ~^~

exercises/fizz-buzz/test_fizz-buzz.R:15:7: style: Use <-, not =, for assignment.

ans100="1
      ^

exercises/fizz-buzz/test_fizz-buzz.R:15:7: style: Put spaces around all infix operators.

ans100="1
     ~^~

exercises/fizz-buzz/test_fizz-buzz.R:116:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:117:34: style: Commas should always have a space after.

​  expect_identical(fizz_buzz(10),cat(ans10) )
                                 ^

exercises/fizz-buzz/test_fizz-buzz.R:118:35: style: Commas should always have a space after.

​  expect_identical(fizz_buzz(100),cat(ans100) )
                                  ^

@lintr-bot
Copy link

exercises/fizz-buzz/example.R:1:11: style: Use <-, not =, for assignment.

fizz_buzz = function(input) {
          ^

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:3:9: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
       ~^~~

exercises/fizz-buzz/example.R:3:12: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
          ~^~~

exercises/fizz-buzz/example.R:3:20: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                  ~^~~

exercises/fizz-buzz/example.R:3:23: style: Put spaces around all infix operators.

if(i%%3==0 && i%%5==0){
                     ~^~~

exercises/fizz-buzz/example.R:5:15: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
             ~^~~

exercises/fizz-buzz/example.R:5:18: style: Put spaces around all infix operators.

​    }else if(i%%3==0){
                ~^~~

exercises/fizz-buzz/example.R:7:15: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
             ~^~~

exercises/fizz-buzz/example.R:7:18: style: Put spaces around all infix operators.

​    }else if(i%%5==0){
                ~^~~

exercises/fizz-buzz/example.R:14:6: style: Put spaces around all infix operators.

out<-sapply(seq(1,input),condition)
    ~^~~

exercises/fizz-buzz/example.R:14:21: style: Commas should always have a space after.

out<-sapply(seq(1,input),condition)
                    ^

exercises/fizz-buzz/example.R:14:28: style: Commas should always have a space after.

out<-sapply(seq(1,input),condition)
                           ^

exercises/fizz-buzz/example.R:15:19: style: Commas should always have a space after.

return (cat(out,sep="\n"))
                  ^

exercises/fizz-buzz/example.R:15:22: style: Put spaces around all infix operators.

return (cat(out,sep="\n"))
                    ~^~

exercises/fizz-buzz/fizz-buzz.R:1:11: style: Use <-, not =, for assignment.

fizz_buzz = function(input){
          ^

exercises/fizz-buzz/test_fizz-buzz.R:4:6: style: Use <-, not =, for assignment.

ans10="1
     ^

exercises/fizz-buzz/test_fizz-buzz.R:4:6: style: Put spaces around all infix operators.

ans10="1
    ~^~

exercises/fizz-buzz/test_fizz-buzz.R:15:7: style: Use <-, not =, for assignment.

ans100="1
      ^

exercises/fizz-buzz/test_fizz-buzz.R:15:7: style: Put spaces around all infix operators.

ans100="1
     ~^~

exercises/fizz-buzz/test_fizz-buzz.R:116:37: style: Commas should always have a space after.

​test_that("Vector of strings match",{
                                    ^

exercises/fizz-buzz/test_fizz-buzz.R:117:34: style: Commas should always have a space after.

​  expect_identical(fizz_buzz(10),cat(ans10) )
                                 ^

exercises/fizz-buzz/test_fizz-buzz.R:118:35: style: Commas should always have a space after.

​  expect_identical(fizz_buzz(100),cat(ans100) )
                                  ^

@lintr-bot

This comment has been minimized.

2 similar comments
@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:14:23: style: Commas should always have a space after.

out <- sapply(seq(1,input), condition)
                      ^

@lintr-bot
Copy link

exercises/fizz-buzz/example.R:2:12: style: Put spaces around all infix operators.

condition<-function(i){
          ~^~~

exercises/fizz-buzz/example.R:14:23: style: Commas should always have a space after.

out <- sapply(seq(1,input), condition)
                      ^

@katrinleinweber
Copy link
Contributor

Welcome to exeRcism, @tintinthong & thanks for this improvement suggestion :-)

I'll be busy in the 1st half of this week, but have made a note to review it later this week.

@exercism/r: If anyone of you have time before, please feel free to take over.

Cheers!

config.json Outdated Show resolved Hide resolved
Copy link
Contributor

@katrinleinweber katrinleinweber left a comment

Choose a reason for hiding this comment

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

This is a tough call, since this problem is not in the common specifications. I think we can still include it, after the conversations I started in the diff are resolved. Are you OK with those requested changes? I'd be happy to help in case you have any questions about iterating on this PR.

@tintinthong
Copy link
Contributor Author

tintinthong commented Jul 26, 2019

@katrinleinweber

This is a tough call, since this problem is not in the common specifications. I think we can still include it, after the conversations I started in the diff are resolved. Are you OK with those requested changes? I'd be happy to help in case you have any questions about iterating on this PR.

Yes, I am fine with the corresponding changes and have made them.

I am partially confused with the use of problem-specifications. Does it mean all problems created in the exercism/R must correspond to one of the meta problems as described in problem-specifications. In that case, I'll be happy to check the boxes (make questions) with the problem-spcifications as my reference.

@katrinleinweber
Copy link
Contributor

katrinleinweber commented Jul 27, 2019

Thanks for the update :-) Shall I squash before merging, or do you want to?

I am partially confused with the use of problem-specifications.

@jonmcalder created (al)most (all) of our exercises and AFAIK all from the prob-spec template. We can have others, but it might be worthwhile to follow up this PR with one to problem-specifications. Maybe in coop with the fine people in exercism/rust#828? I'm worried (maybe unreasonably so) about the tracks drifting too far apart and am therefore guessing that a fizz-buzz prob-spec could help keep the tracks aligned, now that at least two tracks have one such exercise.

@tintinthong
Copy link
Contributor Author

@katrinleinweber in reference with the below,

Thanks for the update :-) Shall I squash before merging, or do you want to?

I am partially confused with the use of problem-specifications.

@jonmcalder created (al)most (all) of our exercises and AFAIK all from the prob-spec template. We can have others, but it might be worthwhile to follow up this PR with one to problem-specifications. Maybe in coop with the fine people in exercism/rust#828? I'm worried (maybe unreasonably so) about the tracks drifting too far apart and am therefore guessing that a fizz-buzz prob-spec could help keep the tracks aligned, now that at least two tracks have one such exercise.

uhmmm squash before merging?? not sure what you mean. you can just merge em when you happy.
I'll message them to ask wehther it is worthhwhihle to make a pull request to problem-specs

@katrinleinweber
Copy link
Contributor

katrinleinweber commented Jul 28, 2019

squash before merging?? not sure what you mean.

This, so that the Fix linting errors commits an other minor, PR-internal ones do not enter the master branch. If you want me to do it, I'll ensure that you remain the author, and I get added only as co-author or committer. There is an issue open about this topic, so I'd be interested in trying out the different possibilities.

exercises/fizz-buzz/README.md Outdated Show resolved Hide resolved
* Add files, questions, example answer and tests
* Fix linting errors by lintr-bot
* Add config (using UUID package)
* Style all files using styler::style_directory()
* Change con-cat()-enated string to c()-ombined vector of strings
* Add different sources
* Refactor function name
@katrinleinweber
Copy link
Contributor

OK, done. Thanks again for suggesting this :-)

In case you want to keep your commit series as backup, you can do git checkout -b PR-122-backup e615ccb while on your local master.

@katrinleinweber katrinleinweber merged commit 859be0b into exercism:master Jul 28, 2019
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.

3 participants